Fixed some checkstyle warnings. Changed checkstyle settings to use APL 2.0.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@141200 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9b7bab4288
commit
4952dd85d6
|
@ -26,7 +26,8 @@
|
|||
<module name="TreeWalker">
|
||||
<!-- Verify that EVERY source file has the appropriate license -->
|
||||
<module name="Header">
|
||||
<property name="headerFile" value="LICENSE.txt"/>
|
||||
<property name="headerFile" value="license-header.txt"/>
|
||||
<property name="ignoreLines" value="2"/>
|
||||
</module>
|
||||
|
||||
<module name="OperatorWrap">
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* Copyright 2003-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
|
@ -1,19 +1,17 @@
|
|||
/*
|
||||
* Copyright 2003-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Copyright (c) 2003-2004 The Apache Software Foundation. All rights reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.commons.math;
|
||||
|
||||
|
@ -23,7 +21,7 @@ import java.io.Serializable;
|
|||
* Error thrown when a numerical computation can not be performed because the
|
||||
* numerical result failed to converge to a finite value.
|
||||
*
|
||||
* @version $Revision: 1.11 $ $Date: 2004/04/08 20:46:00 $
|
||||
* @version $Revision: 1.12 $ $Date: 2004/04/27 04:37:58 $
|
||||
*/
|
||||
public class ConvergenceException extends MathException implements Serializable{
|
||||
/**
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
/*
|
||||
* Copyright 2003-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Copyright (c) 2003-2004 The Apache Software Foundation. All rights reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.commons.math;
|
||||
|
||||
|
@ -21,7 +19,7 @@ import java.io.Serializable;
|
|||
|
||||
/**
|
||||
* Signals a configuration problem with any of the factory methods.
|
||||
* @version $Revision: 1.15 $ $Date: 2004/02/18 03:24:19 $
|
||||
* @version $Revision: 1.16 $ $Date: 2004/04/27 04:37:58 $
|
||||
*/
|
||||
public class MathConfigurationException extends MathException implements Serializable {
|
||||
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
/*
|
||||
* Copyright 2003-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Copyright (c) 2003-2004 The Apache Software Foundation. All rights reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.commons.math;
|
||||
|
||||
|
@ -23,7 +21,7 @@ import org.apache.commons.lang.exception.NestableException;
|
|||
|
||||
/**
|
||||
* A generic exception indicating problems in the math package.
|
||||
* @version $Revision: 1.14 $ $Date: 2004/02/18 03:24:19 $
|
||||
* @version $Revision: 1.15 $ $Date: 2004/04/27 04:37:58 $
|
||||
*/
|
||||
public class MathException extends NestableException implements Serializable {
|
||||
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
/*
|
||||
* Copyright 2003-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Copyright (c) 2003-2004 The Apache Software Foundation. All rights reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.commons.math.analysis;
|
||||
|
||||
|
@ -25,7 +23,7 @@ import org.apache.commons.math.MathException;
|
|||
* Implements the <a href="http://mathworld.wolfram.com/Bisection.html">bisection algorithm</a>
|
||||
* for finding zeros of univariate real functions. This algorithm will find only one zero in the given interval.
|
||||
* The function should be continuous but not necessarily smooth.
|
||||
* @version $Revision: 1.13 $ $Date: 2004/04/08 21:19:17 $
|
||||
* @version $Revision: 1.14 $ $Date: 2004/04/27 04:37:58 $
|
||||
*/
|
||||
public class BisectionSolver extends UnivariateRealSolverImpl implements Serializable {
|
||||
/**
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
/*
|
||||
* Copyright 2003-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Copyright (c) 2003-2004 The Apache Software Foundation. All rights reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.commons.math.analysis;
|
||||
|
||||
|
@ -27,7 +25,7 @@ import org.apache.commons.math.MathException;
|
|||
* functions. This algorithm will find only one zero in the given interval.
|
||||
* The function should be continuous but not necessarily smooth.
|
||||
*
|
||||
* @version $Revision: 1.13 $ $Date: 2004/02/20 06:22:39 $
|
||||
* @version $Revision: 1.14 $ $Date: 2004/04/27 04:37:58 $
|
||||
*/
|
||||
public class BrentSolver extends UnivariateRealSolverImpl implements Serializable {
|
||||
/**
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2004 The Apache Software Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.commons.math.analysis;
|
||||
|
@ -27,7 +26,7 @@ import org.apache.commons.math.MathException;
|
|||
* algorithm will find only one zero in the given interval. The function should
|
||||
* be continuous but not necessarily smooth.
|
||||
*
|
||||
* @version $Revision: 1.2 $ $Date: 2004/04/26 19:15:48 $
|
||||
* @version $Revision: 1.3 $ $Date: 2004/04/27 04:37:58 $
|
||||
*/
|
||||
public class NewtonSolver extends UnivariateRealSolverImpl implements Serializable {
|
||||
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
/*
|
||||
* Copyright 2003-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Copyright (c) 2003-2004 The Apache Software Foundation. All rights reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.commons.math.analysis;
|
||||
|
||||
|
@ -25,7 +23,7 @@ import java.io.Serializable;
|
|||
* <a href="http://mathworld.wolfram.com/HornersMethod.html">Horner's Method</a>
|
||||
* is used to evaluate the function.
|
||||
*
|
||||
* @version $Revision: 1.8 $ $Date: 2004/04/02 21:08:48 $
|
||||
* @version $Revision: 1.9 $ $Date: 2004/04/27 04:37:58 $
|
||||
*/
|
||||
public class PolynomialFunction implements DifferentiableUnivariateRealFunction, Serializable {
|
||||
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
/*
|
||||
* Copyright 2003-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Copyright (c) 2004 The Apache Software Foundation. All rights reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.commons.math.analysis;
|
||||
|
||||
|
@ -43,7 +41,7 @@ import org.apache.commons.math.MathException;
|
|||
* <li> Let <code>j</code> be the index of the largest knot point that is less than or equal to <code>x</code>.
|
||||
* The value returned is <br> <code>polynomials[j](x - knot[j])</code></li></ol>
|
||||
*
|
||||
* @version $Revision: 1.3 $ $Date: 2004/04/23 18:16:06 $
|
||||
* @version $Revision: 1.4 $ $Date: 2004/04/27 04:37:58 $
|
||||
*/
|
||||
public class PolynomialSplineFunction implements UnivariateRealFunction, Serializable {
|
||||
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
/*
|
||||
* Copyright 2003-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Copyright (c) 2003-2004 The Apache Software Foundation. All rights reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.commons.math.analysis;
|
||||
|
||||
|
@ -33,7 +31,7 @@ import org.apache.commons.math.MathException;
|
|||
* <p>
|
||||
* The function is supposed to be continuous but not necessarily smooth.
|
||||
*
|
||||
* @version $Revision: 1.13 $ $Date: 2004/02/22 22:01:29 $
|
||||
* @version $Revision: 1.14 $ $Date: 2004/04/27 04:37:58 $
|
||||
*/
|
||||
public class SecantSolver extends UnivariateRealSolverImpl implements Serializable {
|
||||
/**
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
/*
|
||||
* Copyright 2003-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Copyright (c) 2003-2004 The Apache Software Foundation. All rights reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.commons.math.analysis;
|
||||
|
||||
|
@ -41,7 +39,7 @@ import java.io.Serializable;
|
|||
* The cubic spline interpolation algorithm implemented is as described in R.L. Burden, J.D. Faires,
|
||||
* <u>Numerical Analysis</u>, 4th Ed., 1989, PWS-Kent, ISBN 0-53491-585-X, pp 126-131.
|
||||
*
|
||||
* @version $Revision: 1.15 $ $Date: 2004/04/02 21:16:21 $
|
||||
* @version $Revision: 1.16 $ $Date: 2004/04/27 04:37:58 $
|
||||
*
|
||||
*/
|
||||
public class SplineInterpolator implements UnivariateRealInterpolator, Serializable {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2004,2004 The Apache Software Foundation.
|
||||
* Copyright 2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -24,7 +24,7 @@ import java.text.NumberFormat;
|
|||
* can be configured.
|
||||
*
|
||||
* @author Apache Software Foundation
|
||||
* @version $Revision: 1.4 $
|
||||
* @version $Revision: 1.5 $ $Date: 2004/04/27 04:37:59 $
|
||||
*/
|
||||
public class ComplexFormat {
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.apache.commons.math.util.MathUtils;
|
|||
/**
|
||||
* The default implementation of {@link BinomialDistribution}.
|
||||
*
|
||||
* @version $Revision: 1.12 $ $Date: 2004/04/08 20:45:59 $
|
||||
* @version $Revision: 1.13 $ $Date: 2004/04/27 04:37:58 $
|
||||
*/
|
||||
public class BinomialDistributionImpl
|
||||
extends AbstractDiscreteDistribution
|
||||
|
@ -125,8 +125,7 @@ public class BinomialDistributionImpl
|
|||
ret = 1.0;
|
||||
} else {
|
||||
ret =
|
||||
1.0
|
||||
- Beta.regularizedBeta(
|
||||
1.0 - Beta.regularizedBeta(
|
||||
getProbabilityOfSuccess(),
|
||||
x + 1.0,
|
||||
getNumberOfTrials() - x);
|
||||
|
@ -144,12 +143,11 @@ public class BinomialDistributionImpl
|
|||
if (x < 0 || x > getNumberOfTrials()) {
|
||||
ret = 0.0;
|
||||
} else {
|
||||
ret =
|
||||
MathUtils.binomialCoefficientDouble(getNumberOfTrials(), x)
|
||||
* Math.pow(getProbabilityOfSuccess(), x)
|
||||
* Math.pow(
|
||||
1.0 - getProbabilityOfSuccess(),
|
||||
getNumberOfTrials() - x);
|
||||
ret = MathUtils.binomialCoefficientDouble(
|
||||
getNumberOfTrials(), x) *
|
||||
Math.pow(getProbabilityOfSuccess(), x) *
|
||||
Math.pow(1.0 - getProbabilityOfSuccess(),
|
||||
getNumberOfTrials() - x);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2004,2004 The Apache Software Foundation.
|
||||
* Copyright 2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -29,7 +29,7 @@ package org.apache.commons.math.distribution;
|
|||
* </ul>
|
||||
* </p>
|
||||
*
|
||||
* @version $Revision: 1.4 $ $Date: 2004/04/26 19:15:48 $
|
||||
* @version $Revision: 1.5 $ $Date: 2004/04/27 04:37:58 $
|
||||
*/
|
||||
public interface NormalDistribution extends ContinuousDistribution {
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2004,2004 The Apache Software Foundation.
|
||||
* Copyright 2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -24,6 +24,8 @@ import java.io.Serializable;
|
|||
* You can choose the algorithm used to calculate cumulative probability
|
||||
* using method {@link #setCdfAlgorithm}. The deafault is the Cody algorithm
|
||||
* {@link org.apache.commons.math.distribution.NormalCDFPreciseAlgorithm}
|
||||
*
|
||||
* @version $Revision: 1.5 $ $Date: 2004/04/27 04:37:58 $
|
||||
*/
|
||||
public class NormalDistributionImpl extends AbstractContinuousDistribution
|
||||
implements NormalDistribution, Serializable {
|
||||
|
@ -52,9 +54,7 @@ public class NormalDistributionImpl extends AbstractContinuousDistribution
|
|||
* deviation equal to one.
|
||||
*/
|
||||
public NormalDistributionImpl(){
|
||||
super();
|
||||
setMean(0.0);
|
||||
setStandardDeviation(1.0);
|
||||
this(0.0, 1.0);
|
||||
}
|
||||
/**
|
||||
* Access the mean.
|
||||
|
@ -98,7 +98,7 @@ public class NormalDistributionImpl extends AbstractContinuousDistribution
|
|||
public double cumulativeProbability(double x) {
|
||||
double z = x;
|
||||
if(standardDeviation > 0){
|
||||
z = (x - mean)/standardDeviation;
|
||||
z = (x - mean) / standardDeviation;
|
||||
}else{
|
||||
return 0.0;
|
||||
}
|
||||
|
@ -133,7 +133,8 @@ public class NormalDistributionImpl extends AbstractContinuousDistribution
|
|||
*/
|
||||
public double inverseCumulativeProbability(double p) {
|
||||
if (p < 0.0 || p > 1.0) {
|
||||
throw new IllegalArgumentException("p must be between 0.0 and 1.0, inclusive.");
|
||||
throw new IllegalArgumentException(
|
||||
"p must be between 0.0 and 1.0, inclusive.");
|
||||
}
|
||||
|
||||
//TODO is this ok?
|
||||
|
@ -157,10 +158,11 @@ public class NormalDistributionImpl extends AbstractContinuousDistribution
|
|||
21213.794301586595867) * r + 5394.1960214247511077) * r +
|
||||
687.1870074920579083) * r + 42.313330701600911252) * r + 1.);
|
||||
}else { //closer than 0.075 from {0,1} boundary
|
||||
if (q > 0)
|
||||
if (q > 0) {
|
||||
r = 1 - p;
|
||||
else
|
||||
} else {
|
||||
r = p;
|
||||
}
|
||||
r = Math.sqrt(- Math.log(r));
|
||||
if (r <= 5.0) {
|
||||
r += -1.6;
|
||||
|
@ -183,18 +185,18 @@ public class NormalDistributionImpl extends AbstractContinuousDistribution
|
|||
0.0012426609473880784386) * r + 0.026532189526576123093) *
|
||||
r + 0.29656057182850489123) * r +
|
||||
1.7848265399172913358) * r + 5.4637849111641143699) *
|
||||
r + 6.6579046435011037772)
|
||||
/ (((((((r *
|
||||
r + 6.6579046435011037772) /
|
||||
(((((((r *
|
||||
2.04426310338993978564e-15 + 1.4215117583164458887e-7)*
|
||||
r + 1.8463183175100546818e-5) * r +
|
||||
7.868691311456132591e-4) * r + 0.0148753612908506148525)
|
||||
* r + 0.13692988092273580531) * r +
|
||||
7.868691311456132591e-4) * r + 0.0148753612908506148525) *
|
||||
r + 0.13692988092273580531) * r +
|
||||
0.59983220655588793769) * r + 1.0);
|
||||
}
|
||||
if(q < 0.0)
|
||||
val = -val;
|
||||
}
|
||||
return mean + standardDeviation*val;
|
||||
return mean + standardDeviation * val;
|
||||
}
|
||||
|
||||
|
||||
|
@ -253,6 +255,4 @@ public class NormalDistributionImpl extends AbstractContinuousDistribution
|
|||
protected double getInitialDomain(double p) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
/*
|
||||
* Copyright 2004 The Apache Software Foundation.
|
||||
*
|
||||
* Copyright (c) 2004 The Apache Software Foundation. All rights reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.commons.math.linear;
|
||||
|
@ -24,7 +22,7 @@ import org.apache.commons.lang.exception.NestableRuntimeException;
|
|||
* Thrown when a system attempts an operation on a matrix, and
|
||||
* that matrix does not satisfy the preconditions for the
|
||||
* aforementioned operation.
|
||||
* @version $Revision: 1.3 $ $Date: 2004/04/08 20:46:01 $
|
||||
* @version $Revision: 1.4 $ $Date: 2004/04/27 04:37:58 $
|
||||
*/
|
||||
public class InvalidMatrixException extends NestableRuntimeException {
|
||||
/**
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
/*
|
||||
* Copyright 2004 The Apache Software Foundation.
|
||||
*
|
||||
* Copyright (c) 2004 The Apache Software Foundation. All rights reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.commons.math.linear;
|
||||
|
@ -23,7 +21,7 @@ import org.apache.commons.lang.exception.NestableRuntimeException;
|
|||
/**
|
||||
* Thrown when an operation addresses a matrix coordinate (row,col)
|
||||
* which is outside of the dimensions of a matrix.
|
||||
* @version $Revision: 1.3 $ $Date: 2004/04/08 20:46:01 $
|
||||
* @version $Revision: 1.4 $ $Date: 2004/04/27 04:37:58 $
|
||||
*/
|
||||
public class MatrixIndexException extends NestableRuntimeException {
|
||||
/**
|
||||
|
|
|
@ -1,26 +1,24 @@
|
|||
/*
|
||||
* Copyright 2003-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Copyright (c) 2003-2004 The Apache Software Foundation. All rights reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.commons.math.linear;
|
||||
|
||||
/**
|
||||
* Interface defining a real-valued matrix with basic algebraic operations
|
||||
* @version $Revision: 1.15 $ $Date: 2004/04/11 19:00:45 $
|
||||
* @version $Revision: 1.16 $ $Date: 2004/04/27 04:37:58 $
|
||||
*/
|
||||
public interface RealMatrix {
|
||||
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
/*
|
||||
* Copyright 2003-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Copyright (c) 2003-2004 The Apache Software Foundation. All rights reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.commons.math.linear;
|
||||
|
@ -40,7 +38,7 @@ import java.io.Serializable;
|
|||
* explicitly invoke <code>LUDecompose()</code> to recompute the decomposition
|
||||
* before using any of the methods above.
|
||||
*
|
||||
* @version $Revision: 1.18 $ $Date: 2004/04/11 19:00:45 $
|
||||
* @version $Revision: 1.19 $ $Date: 2004/04/27 04:37:58 $
|
||||
*/
|
||||
public class RealMatrixImpl implements RealMatrix, Serializable {
|
||||
|
||||
|
@ -125,8 +123,8 @@ public class RealMatrixImpl implements RealMatrix, Serializable {
|
|||
* @exception IllegalArgumentException if m is not the same size as this
|
||||
*/
|
||||
public RealMatrix add(RealMatrix m) throws IllegalArgumentException {
|
||||
if (this.getColumnDimension() != m.getColumnDimension()
|
||||
|| this.getRowDimension() != m.getRowDimension()) {
|
||||
if (this.getColumnDimension() != m.getColumnDimension() ||
|
||||
this.getRowDimension() != m.getRowDimension()) {
|
||||
throw new IllegalArgumentException("matrix dimension mismatch");
|
||||
}
|
||||
int rowCount = this.getRowDimension();
|
||||
|
@ -149,8 +147,8 @@ public class RealMatrixImpl implements RealMatrix, Serializable {
|
|||
* @exception IllegalArgumentException if m is not the same size as *this
|
||||
*/
|
||||
public RealMatrix subtract(RealMatrix m) throws IllegalArgumentException {
|
||||
if (this.getColumnDimension() != m.getColumnDimension()
|
||||
|| this.getRowDimension() != m.getRowDimension()) {
|
||||
if (this.getColumnDimension() != m.getColumnDimension() ||
|
||||
this.getRowDimension() != m.getRowDimension()) {
|
||||
throw new IllegalArgumentException("matrix dimension mismatch");
|
||||
}
|
||||
int rowCount = this.getRowDimension();
|
||||
|
@ -835,6 +833,8 @@ public class RealMatrixImpl implements RealMatrix, Serializable {
|
|||
/**
|
||||
* Tests a given coordinate as being valid or invalid
|
||||
*
|
||||
* @param row the row index.
|
||||
* @param col the column index.
|
||||
* @return true if the coordinate is with the current dimensions
|
||||
*/
|
||||
private boolean isValidCoordinate(int row, int col) {
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
/*
|
||||
* Copyright 2003-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Copyright (c) 2003-2004 The Apache Software Foundation. All rights reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.commons.math.special;
|
||||
|
||||
|
@ -26,7 +24,7 @@ import org.apache.commons.math.util.ContinuedFraction;
|
|||
* This is a utility class that provides computation methods related to the
|
||||
* Beta family of functions.
|
||||
*
|
||||
* @version $Revision: 1.18 $ $Date: 2004/04/23 19:30:47 $
|
||||
* @version $Revision: 1.19 $ $Date: 2004/04/27 04:37:59 $
|
||||
*/
|
||||
public class Beta implements Serializable {
|
||||
/** Maximum allowed numerical error. */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2004,2004 The Apache Software Foundation.
|
||||
* Copyright 2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -18,7 +18,7 @@ package org.apache.commons.math.stat.univariate;
|
|||
/**
|
||||
* Reporting interface for basic univariate statistics.
|
||||
*
|
||||
* @version $Revision: 1.1 $ $Date: 2004/04/12 02:27:49 $
|
||||
* @version $Revision: 1.2 $ $Date: 2004/04/27 04:37:59 $
|
||||
*/
|
||||
public interface StatisticalSummary {
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2004,2004 The Apache Software Foundation.
|
||||
* Copyright 2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -22,7 +22,7 @@ import org.apache.commons.discovery.tools.DiscoverClass;
|
|||
/**
|
||||
* Abstract factory class for univariate statistical summaries.
|
||||
*
|
||||
* @version $Revision: 1.2 $ $Date: 2004/04/23 19:50:27 $
|
||||
* @version $Revision: 1.3 $ $Date: 2004/04/27 04:37:59 $
|
||||
*/
|
||||
public abstract class SummaryStatistics implements Serializable, StatisticalSummary{
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2004,2004 The Apache Software Foundation.
|
||||
* Copyright 2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -28,7 +28,7 @@ import org.apache.commons.math.stat.univariate.summary.SumOfSquares;
|
|||
/**
|
||||
* Provides a default {@link SummaryStatistics} implementation.
|
||||
*
|
||||
* @version $Revision: 1.1 $ $Date: 2004/04/12 02:27:49 $
|
||||
* @version $Revision: 1.2 $ $Date: 2004/04/27 04:37:59 $
|
||||
*/
|
||||
public class SummaryStatisticsImpl extends SummaryStatistics {
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
/*
|
||||
* Copyright 2003-2004 The Apache Software Foundation.
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
@ -19,7 +19,7 @@ package org.apache.commons.math.util;
|
|||
/**
|
||||
* Some useful additions to the built-in functions in {@link Math}.
|
||||
*
|
||||
* @version $Revision: 1.14 $ $Date: 2004/04/08 20:46:01 $
|
||||
* @version $Revision: 1.15 $ $Date: 2004/04/27 04:37:59 $
|
||||
*/
|
||||
public final class MathUtils {
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2004,2004 The Apache Software Foundation.
|
||||
* Copyright 2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2004,2004 The Apache Software Foundation.
|
||||
* Copyright 2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
-->
|
||||
|
||||
<?xml-stylesheet type="text/xsl" href="xdoc.xsl"?>
|
||||
<!-- $Revision: 1.19 $ $Date: 2004/04/05 05:22:00 $ -->
|
||||
<!-- $Revision: 1.20 $ $Date: 2004/04/27 04:37:59 $ -->
|
||||
<document>
|
||||
<properties>
|
||||
<title>Tasks: Done And To Do</title>
|
||||
|
@ -35,7 +35,7 @@
|
|||
test cases as possible for your code.</p>
|
||||
<dl>
|
||||
<dt>Develop user's guide following the package structure.</dt>
|
||||
<dd>Missing sections: complex, utilities, linear. Incomplete: stat (missing BivariateRegression, Statistical Tests)</dd>
|
||||
<dd>Incomplete Sections: 1.5 Statistical Tests, 3.1 Linear Algebra Overview, 3.2 Real Matrices, 3.3 Solving Linear Systems, 6.1 Utilities Overview, 6.2 Double Array Utilities, 6.4 Binomial Coefficients, ..., 6.5 Statistical Computation Utilities, 7.4 Complex Formatting</dd>
|
||||
<dt>Performance and accuracy testing.</dt>
|
||||
<dd>If anyone is interested in helping out here, what we could really use is a wider selection of test cases for the core
|
||||
numerical functions and validation against either other packages (e.g. R for the statistical stuff), verified datasets,
|
||||
|
|
Loading…
Reference in New Issue