Merge branch 'MATH_3_X' into 3.6-release
This commit is contained in:
commit
47ae2b7c84
21
build.xml
21
build.xml
|
@ -30,12 +30,12 @@
|
||||||
|
|
||||||
<!-- ========== External Dependencies ===================================== -->
|
<!-- ========== External Dependencies ===================================== -->
|
||||||
|
|
||||||
|
<property name="repository" value = "${user.home}/.m2/repository"/>
|
||||||
|
|
||||||
<!-- Junit -->
|
<!-- Junit -->
|
||||||
<property name="junit.version" value="4.8.2"/>
|
<property name="junit.version" value="4.11"/>
|
||||||
<property name="junit.home" value="/usr/share/junit"/>
|
<property name="junit.jar" value="$junit-{junit.version}.jar"/>
|
||||||
<property name="junit.jar" value="${junit.home}/junit-${junit.version}.jar"/>
|
<property name="hamcrest.jar" value="hamcrest-core-1.3.jar"/>
|
||||||
|
|
||||||
|
|
||||||
<!-- ========== Component Declarations ==================================== -->
|
<!-- ========== Component Declarations ==================================== -->
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
<property name="component.title" value="Commons MATH"/>
|
<property name="component.title" value="Commons MATH"/>
|
||||||
|
|
||||||
<!-- The current version number of this component -->
|
<!-- The current version number of this component -->
|
||||||
<property name="component.version" value="3.5"/>
|
<property name="component.version" value="3.6"/>
|
||||||
|
|
||||||
<!-- The base directory for component sources -->
|
<!-- The base directory for component sources -->
|
||||||
<property name="source.home" value="src/main/java"/>
|
<property name="source.home" value="src/main/java"/>
|
||||||
|
@ -111,6 +111,7 @@
|
||||||
<!-- External dependency classpath -->
|
<!-- External dependency classpath -->
|
||||||
<path id="downloaded.lib.classpath">
|
<path id="downloaded.lib.classpath">
|
||||||
<pathelement location="${download.lib.dir}/junit-${junit.version}.jar"/>
|
<pathelement location="${download.lib.dir}/junit-${junit.version}.jar"/>
|
||||||
|
<pathelement location="${download.lib.dir}/${hamcrest.jar}"/>
|
||||||
</path>
|
</path>
|
||||||
|
|
||||||
<!-- ========== Test Execution Defaults =================================== -->
|
<!-- ========== Test Execution Defaults =================================== -->
|
||||||
|
@ -121,6 +122,7 @@
|
||||||
<pathelement location="${build.home}/classes"/>
|
<pathelement location="${build.home}/classes"/>
|
||||||
<pathelement location="${build.home}/test-classes"/>
|
<pathelement location="${build.home}/test-classes"/>
|
||||||
<pathelement location="${junit.jar}"/>
|
<pathelement location="${junit.jar}"/>
|
||||||
|
<pathelement location="${hamcrest.jar}"/>
|
||||||
<path refid="downloaded.lib.classpath"/>
|
<path refid="downloaded.lib.classpath"/>
|
||||||
</path>
|
</path>
|
||||||
|
|
||||||
|
@ -346,6 +348,7 @@
|
||||||
depends="check-availability" unless="skip.download">
|
depends="check-availability" unless="skip.download">
|
||||||
<echo message="doing download-dependencies..." />
|
<echo message="doing download-dependencies..." />
|
||||||
<antcall target="download-junit" />
|
<antcall target="download-junit" />
|
||||||
|
<antcall target="download-hamcrest" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="check-availability">
|
<target name="check-availability">
|
||||||
|
@ -361,5 +364,13 @@
|
||||||
src="http://repo1.maven.org/maven2/junit/junit/${junit.version}/junit-${junit.version}.jar"/>
|
src="http://repo1.maven.org/maven2/junit/junit/${junit.version}/junit-${junit.version}.jar"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
<target name="download-hamcrest" unless="hamcrest.found">
|
||||||
|
<echo message="Downloading hamcrest..."/>
|
||||||
|
<mkdir dir="${download.lib.dir}" />
|
||||||
|
<get dest="${download.lib.dir}/${hamcrest.jar}"
|
||||||
|
usetimestamp="true" ignoreerrors="true"
|
||||||
|
src="http://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
||||||
|
|
|
@ -313,18 +313,19 @@ edit README.html with released version number
|
||||||
(13)
|
(13)
|
||||||
As the web site staging area is shared among all commons components and therefore
|
As the web site staging area is shared among all commons components and therefore
|
||||||
can be published before vote ends, it is not recommended to use the standard staging
|
can be published before vote ends, it is not recommended to use the standard staging
|
||||||
area for the release candidate. So you will just archive the site and transfer it on
|
area for the release candidate. So you will just archive the transfer the site it on
|
||||||
your apache personal area for review:
|
your apache personal area for review. Here is how to do this using lftp to initiate
|
||||||
|
the sftp transfer (lftp supports a mirror command for recursive transfers, don't
|
||||||
|
forget the -R flag for uploading instead of downloading the site):
|
||||||
|
|
||||||
$ mvn site
|
$ mvn site
|
||||||
$ cd target
|
$ cd target
|
||||||
$ tar czf site.tar.gz site
|
$ mv site commons-math-3.4-RC1-site
|
||||||
$ scp site.tar.gz __Your_apache_login__@people.apache.org:~/
|
$ lftp sftp://__Your_apache_login__@home.apache.org/
|
||||||
$ ssh __Your_apache_login__@people.apache.org
|
lftp you@home.apache.org:~> cd public_html
|
||||||
you@minotaur:~$ tar xzf site.tar.gz
|
lftp you@home.apache.org:~/public_html> mirror -R commons-math-3.4-RC1-site
|
||||||
you@minotaur:~$ mv site public_html/commons-math-3.4-RC1-site
|
lftp you@home.apache.org:~/public_html> bye
|
||||||
you@minotaur:~$ rm site.tar.gz
|
|
||||||
you@minotaur:~$ logout
|
|
||||||
|
|
||||||
(14)
|
(14)
|
||||||
Call to vote by sending a message to the "dev" ML with subject
|
Call to vote by sending a message to the "dev" ML with subject
|
||||||
|
@ -343,7 +344,7 @@ Commit ID the tag points at:
|
||||||
cf4a9d70c9ac24dd7196995390171150e4e56451
|
cf4a9d70c9ac24dd7196995390171150e4e56451
|
||||||
|
|
||||||
Site:
|
Site:
|
||||||
<http://people.apache.org/~__Your_apache_login__/commons-math-3.4-RC1-site>
|
<http://home.apache.org/~__Your_apache_login__/commons-math-3.4-RC1-site>
|
||||||
|
|
||||||
Distribution files:
|
Distribution files:
|
||||||
https://dist.apache.org/repos/dist/dev/commons/math/
|
https://dist.apache.org/repos/dist/dev/commons/math/
|
||||||
|
|
|
@ -32,7 +32,7 @@ import org.apache.commons.math3.util.Precision;
|
||||||
/**
|
/**
|
||||||
* Representation of a Complex number, i.e. a number which has both a
|
* Representation of a Complex number, i.e. a number which has both a
|
||||||
* real and imaginary part.
|
* real and imaginary part.
|
||||||
* <br/>
|
* <p>
|
||||||
* Implementations of arithmetic operations handle {@code NaN} and
|
* Implementations of arithmetic operations handle {@code NaN} and
|
||||||
* infinite values according to the rules for {@link java.lang.Double}, i.e.
|
* infinite values according to the rules for {@link java.lang.Double}, i.e.
|
||||||
* {@link #equals} is an equivalence relation for all instances that have
|
* {@link #equals} is an equivalence relation for all instances that have
|
||||||
|
@ -42,16 +42,14 @@ import org.apache.commons.math3.util.Precision;
|
||||||
* <li>{@code 1 + NaNi}</li>
|
* <li>{@code 1 + NaNi}</li>
|
||||||
* <li>{@code NaN + i}</li>
|
* <li>{@code NaN + i}</li>
|
||||||
* <li>{@code NaN + NaNi}</li>
|
* <li>{@code NaN + NaNi}</li>
|
||||||
* </ul>
|
* </ul><p>
|
||||||
* Note that this is in contradiction with the IEEE-754 standard for floating
|
* Note that this contradicts the IEEE-754 standard for floating
|
||||||
* point numbers (according to which the test {@code x == x} must fail if
|
* point numbers (according to which the test {@code x == x} must fail if
|
||||||
* {@code x} is {@code NaN}). The method
|
* {@code x} is {@code NaN}). The method
|
||||||
* {@link org.apache.commons.math3.util.Precision#equals(double,double,int)
|
* {@link org.apache.commons.math3.util.Precision#equals(double,double,int)
|
||||||
* equals for primitive double} in {@link org.apache.commons.math3.util.Precision}
|
* equals for primitive double} in {@link org.apache.commons.math3.util.Precision}
|
||||||
* conforms with IEEE-754 while this class conforms with the standard behavior
|
* conforms with IEEE-754 while this class conforms with the standard behavior
|
||||||
* for Java object types.
|
* for Java object types.</p>
|
||||||
* <br/>
|
|
||||||
* Implements Serializable since 2.0
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class Complex implements FieldElement<Complex>, Serializable {
|
public class Complex implements FieldElement<Complex>, Serializable {
|
||||||
|
@ -138,12 +136,9 @@ public class Complex implements FieldElement<Complex>, Serializable {
|
||||||
* Returns a {@code Complex} whose value is
|
* Returns a {@code Complex} whose value is
|
||||||
* {@code (this + addend)}.
|
* {@code (this + addend)}.
|
||||||
* Uses the definitional formula
|
* Uses the definitional formula
|
||||||
* <pre>
|
* <p>
|
||||||
* <code>
|
* {@code (a + bi) + (c + di) = (a+c) + (b+d)i}
|
||||||
* (a + bi) + (c + di) = (a+c) + (b+d)i
|
* </p>
|
||||||
* </code>
|
|
||||||
* </pre>
|
|
||||||
* <br/>
|
|
||||||
* If either {@code this} or {@code addend} has a {@code NaN} value in
|
* If either {@code this} or {@code addend} has a {@code NaN} value in
|
||||||
* either part, {@link #NaN} is returned; otherwise {@code Infinite}
|
* either part, {@link #NaN} is returned; otherwise {@code Infinite}
|
||||||
* and {@code NaN} values are returned in the parts of the result
|
* and {@code NaN} values are returned in the parts of the result
|
||||||
|
@ -180,17 +175,17 @@ public class Complex implements FieldElement<Complex>, Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the conjugate of this complex number.
|
* Returns the conjugate of this complex number.
|
||||||
* The conjugate of {@code a + bi} is {@code a - bi}.
|
* The conjugate of {@code a + bi} is {@code a - bi}.
|
||||||
* <br/>
|
* <p>
|
||||||
* {@link #NaN} is returned if either the real or imaginary
|
* {@link #NaN} is returned if either the real or imaginary
|
||||||
* part of this Complex number equals {@code Double.NaN}.
|
* part of this Complex number equals {@code Double.NaN}.
|
||||||
* <br/>
|
* </p><p>
|
||||||
* If the imaginary part is infinite, and the real part is not
|
* If the imaginary part is infinite, and the real part is not
|
||||||
* {@code NaN}, the returned value has infinite imaginary part
|
* {@code NaN}, the returned value has infinite imaginary part
|
||||||
* of the opposite sign, e.g. the conjugate of
|
* of the opposite sign, e.g. the conjugate of
|
||||||
* {@code 1 + POSITIVE_INFINITY i} is {@code 1 - NEGATIVE_INFINITY i}.
|
* {@code 1 + POSITIVE_INFINITY i} is {@code 1 - NEGATIVE_INFINITY i}.
|
||||||
*
|
* </p>
|
||||||
* @return the conjugate of this Complex object.
|
* @return the conjugate of this Complex object.
|
||||||
*/
|
*/
|
||||||
public Complex conjugate() {
|
public Complex conjugate() {
|
||||||
|
@ -216,7 +211,7 @@ public class Complex implements FieldElement<Complex>, Serializable {
|
||||||
* <a href="http://doi.acm.org/10.1145/1039813.1039814">
|
* <a href="http://doi.acm.org/10.1145/1039813.1039814">
|
||||||
* prescaling of operands</a> to limit the effects of overflows and
|
* prescaling of operands</a> to limit the effects of overflows and
|
||||||
* underflows in the computation.
|
* underflows in the computation.
|
||||||
* <br/>
|
* <p>
|
||||||
* {@code Infinite} and {@code NaN} values are handled according to the
|
* {@code Infinite} and {@code NaN} values are handled according to the
|
||||||
* following rules, applied in the order presented:
|
* following rules, applied in the order presented:
|
||||||
* <ul>
|
* <ul>
|
||||||
|
@ -401,7 +396,7 @@ public class Complex implements FieldElement<Complex>, Serializable {
|
||||||
* Returns {@code true} if, both for the real part and for the imaginary
|
* Returns {@code true} if, both for the real part and for the imaginary
|
||||||
* part, there is no double value strictly between the arguments or the
|
* part, there is no double value strictly between the arguments or the
|
||||||
* difference between them is within the range of allowed error
|
* difference between them is within the range of allowed error
|
||||||
* (inclusive).
|
* (inclusive). Returns {@code false} if either of the arguments is NaN.
|
||||||
*
|
*
|
||||||
* @param x First value (cannot be {@code null}).
|
* @param x First value (cannot be {@code null}).
|
||||||
* @param y Second value (cannot be {@code null}).
|
* @param y Second value (cannot be {@code null}).
|
||||||
|
@ -421,7 +416,7 @@ public class Complex implements FieldElement<Complex>, Serializable {
|
||||||
* Returns {@code true} if, both for the real part and for the imaginary
|
* Returns {@code true} if, both for the real part and for the imaginary
|
||||||
* part, there is no double value strictly between the arguments or the
|
* part, there is no double value strictly between the arguments or the
|
||||||
* relative difference between them is smaller or equal to the given
|
* relative difference between them is smaller or equal to the given
|
||||||
* tolerance.
|
* tolerance. Returns {@code false} if either of the arguments is NaN.
|
||||||
*
|
*
|
||||||
* @param x First value (cannot be {@code null}).
|
* @param x First value (cannot be {@code null}).
|
||||||
* @param y Second value (cannot be {@code null}).
|
* @param y Second value (cannot be {@code null}).
|
||||||
|
@ -500,21 +495,19 @@ public class Complex implements FieldElement<Complex>, Serializable {
|
||||||
* Returns a {@code Complex} whose value is {@code this * factor}.
|
* Returns a {@code Complex} whose value is {@code this * factor}.
|
||||||
* Implements preliminary checks for {@code NaN} and infinity followed by
|
* Implements preliminary checks for {@code NaN} and infinity followed by
|
||||||
* the definitional formula:
|
* the definitional formula:
|
||||||
* <pre>
|
* <p>
|
||||||
* <code>
|
* {@code (a + bi)(c + di) = (ac - bd) + (ad + bc)i}
|
||||||
* (a + bi)(c + di) = (ac - bd) + (ad + bc)i
|
* </p>
|
||||||
* </code>
|
|
||||||
* </pre>
|
|
||||||
* Returns {@link #NaN} if either {@code this} or {@code factor} has one or
|
* Returns {@link #NaN} if either {@code this} or {@code factor} has one or
|
||||||
* more {@code NaN} parts.
|
* more {@code NaN} parts.
|
||||||
* <br/>
|
* <p>
|
||||||
* Returns {@link #INF} if neither {@code this} nor {@code factor} has one
|
* Returns {@link #INF} if neither {@code this} nor {@code factor} has one
|
||||||
* or more {@code NaN} parts and if either {@code this} or {@code factor}
|
* or more {@code NaN} parts and if either {@code this} or {@code factor}
|
||||||
* has one or more infinite parts (same result is returned regardless of
|
* has one or more infinite parts (same result is returned regardless of
|
||||||
* the sign of the components).
|
* the sign of the components).
|
||||||
* <br/>
|
* </p><p>
|
||||||
* Returns finite values in components of the result per the definitional
|
* Returns finite values in components of the result per the definitional
|
||||||
* formula in all remaining cases.
|
* formula in all remaining cases.</p>
|
||||||
*
|
*
|
||||||
* @param factor value to be multiplied by this {@code Complex}.
|
* @param factor value to be multiplied by this {@code Complex}.
|
||||||
* @return {@code this * factor}.
|
* @return {@code this * factor}.
|
||||||
|
@ -580,7 +573,7 @@ public class Complex implements FieldElement<Complex>, Serializable {
|
||||||
/**
|
/**
|
||||||
* Returns a {@code Complex} whose value is {@code (-this)}.
|
* Returns a {@code Complex} whose value is {@code (-this)}.
|
||||||
* Returns {@code NaN} if either real or imaginary
|
* Returns {@code NaN} if either real or imaginary
|
||||||
* part of this Complex number equals {@code Double.NaN}.
|
* part of this Complex number is {@code Double.NaN}.
|
||||||
*
|
*
|
||||||
* @return {@code -this}.
|
* @return {@code -this}.
|
||||||
*/
|
*/
|
||||||
|
@ -596,11 +589,9 @@ public class Complex implements FieldElement<Complex>, Serializable {
|
||||||
* Returns a {@code Complex} whose value is
|
* Returns a {@code Complex} whose value is
|
||||||
* {@code (this - subtrahend)}.
|
* {@code (this - subtrahend)}.
|
||||||
* Uses the definitional formula
|
* Uses the definitional formula
|
||||||
* <pre>
|
* <p>
|
||||||
* <code>
|
* {@code (a + bi) - (c + di) = (a-c) + (b-d)i}
|
||||||
* (a + bi) - (c + di) = (a-c) + (b-d)i
|
* </p>
|
||||||
* </code>
|
|
||||||
* </pre>
|
|
||||||
* If either {@code this} or {@code subtrahend} has a {@code NaN]} value in either part,
|
* If either {@code this} or {@code subtrahend} has a {@code NaN]} value in either part,
|
||||||
* {@link #NaN} is returned; otherwise infinite and {@code NaN} values are
|
* {@link #NaN} is returned; otherwise infinite and {@code NaN} values are
|
||||||
* returned in the parts of the result according to the rules for
|
* returned in the parts of the result according to the rules for
|
||||||
|
@ -641,11 +632,9 @@ public class Complex implements FieldElement<Complex>, Serializable {
|
||||||
* <a href="http://mathworld.wolfram.com/InverseCosine.html" TARGET="_top">
|
* <a href="http://mathworld.wolfram.com/InverseCosine.html" TARGET="_top">
|
||||||
* inverse cosine</a> of this complex number.
|
* inverse cosine</a> of this complex number.
|
||||||
* Implements the formula:
|
* Implements the formula:
|
||||||
* <pre>
|
* <p>
|
||||||
* <code>
|
* {@code acos(z) = -i (log(z + i (sqrt(1 - z<sup>2</sup>))))}
|
||||||
* acos(z) = -i (log(z + i (sqrt(1 - z<sup>2</sup>))))
|
* </p>
|
||||||
* </code>
|
|
||||||
* </pre>
|
|
||||||
* Returns {@link Complex#NaN} if either real or imaginary part of the
|
* Returns {@link Complex#NaN} if either real or imaginary part of the
|
||||||
* input argument is {@code NaN} or infinite.
|
* input argument is {@code NaN} or infinite.
|
||||||
*
|
*
|
||||||
|
@ -665,13 +654,11 @@ public class Complex implements FieldElement<Complex>, Serializable {
|
||||||
* <a href="http://mathworld.wolfram.com/InverseSine.html" TARGET="_top">
|
* <a href="http://mathworld.wolfram.com/InverseSine.html" TARGET="_top">
|
||||||
* inverse sine</a> of this complex number.
|
* inverse sine</a> of this complex number.
|
||||||
* Implements the formula:
|
* Implements the formula:
|
||||||
* <pre>
|
* <p>
|
||||||
* <code>
|
* {@code asin(z) = -i (log(sqrt(1 - z<sup>2</sup>) + iz))}
|
||||||
* asin(z) = -i (log(sqrt(1 - z<sup>2</sup>) + iz))
|
* </p><p>
|
||||||
* </code>
|
|
||||||
* </pre>
|
|
||||||
* Returns {@link Complex#NaN} if either real or imaginary part of the
|
* Returns {@link Complex#NaN} if either real or imaginary part of the
|
||||||
* input argument is {@code NaN} or infinite.
|
* input argument is {@code NaN} or infinite.</p>
|
||||||
*
|
*
|
||||||
* @return the inverse sine of this complex number.
|
* @return the inverse sine of this complex number.
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
|
@ -689,13 +676,11 @@ public class Complex implements FieldElement<Complex>, Serializable {
|
||||||
* <a href="http://mathworld.wolfram.com/InverseTangent.html" TARGET="_top">
|
* <a href="http://mathworld.wolfram.com/InverseTangent.html" TARGET="_top">
|
||||||
* inverse tangent</a> of this complex number.
|
* inverse tangent</a> of this complex number.
|
||||||
* Implements the formula:
|
* Implements the formula:
|
||||||
* <pre>
|
* <p>
|
||||||
* <code>
|
* {@code atan(z) = (i/2) log((i + z)/(i - z))}
|
||||||
* atan(z) = (i/2) log((i + z)/(i - z))
|
* </p><p>
|
||||||
* </code>
|
|
||||||
* </pre>
|
|
||||||
* Returns {@link Complex#NaN} if either real or imaginary part of the
|
* Returns {@link Complex#NaN} if either real or imaginary part of the
|
||||||
* input argument is {@code NaN} or infinite.
|
* input argument is {@code NaN} or infinite.</p>
|
||||||
*
|
*
|
||||||
* @return the inverse tangent of this complex number
|
* @return the inverse tangent of this complex number
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
|
@ -712,27 +697,24 @@ public class Complex implements FieldElement<Complex>, Serializable {
|
||||||
/**
|
/**
|
||||||
* Compute the
|
* Compute the
|
||||||
* <a href="http://mathworld.wolfram.com/Cosine.html" TARGET="_top">
|
* <a href="http://mathworld.wolfram.com/Cosine.html" TARGET="_top">
|
||||||
* cosine</a>
|
* cosine</a> of this complex number.
|
||||||
* of this complex number.
|
|
||||||
* Implements the formula:
|
* Implements the formula:
|
||||||
* <pre>
|
* <p>
|
||||||
* <code>
|
* {@code cos(a + bi) = cos(a)cosh(b) - sin(a)sinh(b)i}
|
||||||
* cos(a + bi) = cos(a)cosh(b) - sin(a)sinh(b)i
|
* </p><p>
|
||||||
* </code>
|
|
||||||
* </pre>
|
|
||||||
* where the (real) functions on the right-hand side are
|
* where the (real) functions on the right-hand side are
|
||||||
* {@link FastMath#sin}, {@link FastMath#cos},
|
* {@link FastMath#sin}, {@link FastMath#cos},
|
||||||
* {@link FastMath#cosh} and {@link FastMath#sinh}.
|
* {@link FastMath#cosh} and {@link FastMath#sinh}.
|
||||||
* <br/>
|
* </p><p>
|
||||||
* Returns {@link Complex#NaN} if either real or imaginary part of the
|
* Returns {@link Complex#NaN} if either real or imaginary part of the
|
||||||
* input argument is {@code NaN}.
|
* input argument is {@code NaN}.
|
||||||
* <br/>
|
* </p><p>
|
||||||
* Infinite values in real or imaginary parts of the input may result in
|
* Infinite values in real or imaginary parts of the input may result in
|
||||||
* infinite or NaN values returned in parts of the result.
|
* infinite or NaN values returned in parts of the result.</p>
|
||||||
* <pre>
|
* <pre>
|
||||||
* Examples:
|
* Examples:
|
||||||
* <code>
|
* <code>
|
||||||
* cos(1 ± INFINITY i) = 1 ∓ INFINITY i
|
* cos(1 ± INFINITY i) = 1 \u2213 INFINITY i
|
||||||
* cos(±INFINITY + i) = NaN + NaN i
|
* cos(±INFINITY + i) = NaN + NaN i
|
||||||
* cos(±INFINITY ± INFINITY i) = NaN + NaN i
|
* cos(±INFINITY ± INFINITY i) = NaN + NaN i
|
||||||
* </code>
|
* </code>
|
||||||
|
@ -757,16 +739,16 @@ public class Complex implements FieldElement<Complex>, Serializable {
|
||||||
* Implements the formula:
|
* Implements the formula:
|
||||||
* <pre>
|
* <pre>
|
||||||
* <code>
|
* <code>
|
||||||
* cosh(a + bi) = cosh(a)cos(b) + sinh(a)sin(b)i}
|
* cosh(a + bi) = cosh(a)cos(b) + sinh(a)sin(b)i
|
||||||
* </code>
|
* </code>
|
||||||
* </pre>
|
* </pre>
|
||||||
* where the (real) functions on the right-hand side are
|
* where the (real) functions on the right-hand side are
|
||||||
* {@link FastMath#sin}, {@link FastMath#cos},
|
* {@link FastMath#sin}, {@link FastMath#cos},
|
||||||
* {@link FastMath#cosh} and {@link FastMath#sinh}.
|
* {@link FastMath#cosh} and {@link FastMath#sinh}.
|
||||||
* <br/>
|
* <p>
|
||||||
* Returns {@link Complex#NaN} if either real or imaginary part of the
|
* Returns {@link Complex#NaN} if either real or imaginary part of the
|
||||||
* input argument is {@code NaN}.
|
* input argument is {@code NaN}.
|
||||||
* <br/>
|
* </p>
|
||||||
* Infinite values in real or imaginary parts of the input may result in
|
* Infinite values in real or imaginary parts of the input may result in
|
||||||
* infinite or NaN values returned in parts of the result.
|
* infinite or NaN values returned in parts of the result.
|
||||||
* <pre>
|
* <pre>
|
||||||
|
@ -803,10 +785,10 @@ public class Complex implements FieldElement<Complex>, Serializable {
|
||||||
* where the (real) functions on the right-hand side are
|
* where the (real) functions on the right-hand side are
|
||||||
* {@link FastMath#exp}, {@link FastMath#cos}, and
|
* {@link FastMath#exp}, {@link FastMath#cos}, and
|
||||||
* {@link FastMath#sin}.
|
* {@link FastMath#sin}.
|
||||||
* <br/>
|
* <p>
|
||||||
* Returns {@link Complex#NaN} if either real or imaginary part of the
|
* Returns {@link Complex#NaN} if either real or imaginary part of the
|
||||||
* input argument is {@code NaN}.
|
* input argument is {@code NaN}.
|
||||||
* <br/>
|
* </p>
|
||||||
* Infinite values in real or imaginary parts of the input may result in
|
* Infinite values in real or imaginary parts of the input may result in
|
||||||
* infinite or NaN values returned in parts of the result.
|
* infinite or NaN values returned in parts of the result.
|
||||||
* <pre>
|
* <pre>
|
||||||
|
@ -845,10 +827,10 @@ public class Complex implements FieldElement<Complex>, Serializable {
|
||||||
* where ln on the right hand side is {@link FastMath#log},
|
* where ln on the right hand side is {@link FastMath#log},
|
||||||
* {@code |a + bi|} is the modulus, {@link Complex#abs}, and
|
* {@code |a + bi|} is the modulus, {@link Complex#abs}, and
|
||||||
* {@code arg(a + bi) = }{@link FastMath#atan2}(b, a).
|
* {@code arg(a + bi) = }{@link FastMath#atan2}(b, a).
|
||||||
* <br/>
|
* <p>
|
||||||
* Returns {@link Complex#NaN} if either real or imaginary part of the
|
* Returns {@link Complex#NaN} if either real or imaginary part of the
|
||||||
* input argument is {@code NaN}.
|
* input argument is {@code NaN}.
|
||||||
* <br/>
|
* </p>
|
||||||
* Infinite (or critical) values in real or imaginary parts of the input may
|
* Infinite (or critical) values in real or imaginary parts of the input may
|
||||||
* result in infinite or NaN values returned in parts of the result.
|
* result in infinite or NaN values returned in parts of the result.
|
||||||
* <pre>
|
* <pre>
|
||||||
|
@ -886,13 +868,13 @@ public class Complex implements FieldElement<Complex>, Serializable {
|
||||||
* </pre>
|
* </pre>
|
||||||
* where {@code exp} and {@code log} are {@link #exp} and
|
* where {@code exp} and {@code log} are {@link #exp} and
|
||||||
* {@link #log}, respectively.
|
* {@link #log}, respectively.
|
||||||
* <br/>
|
* <p>
|
||||||
* Returns {@link Complex#NaN} if either real or imaginary part of the
|
* Returns {@link Complex#NaN} if either real or imaginary part of the
|
||||||
* input argument is {@code NaN} or infinite, or if {@code y}
|
* input argument is {@code NaN} or infinite, or if {@code y}
|
||||||
* equals {@link Complex#ZERO}.
|
* equals {@link Complex#ZERO}.</p>
|
||||||
*
|
*
|
||||||
* @param x exponent to which this {@code Complex} is to be raised.
|
* @param x exponent to which this {@code Complex} is to be raised.
|
||||||
* @return <code> this<sup>{@code x}</sup></code>.
|
* @return <code> this<sup>x</sup></code>.
|
||||||
* @throws NullArgumentException if x is {@code null}.
|
* @throws NullArgumentException if x is {@code null}.
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
|
@ -927,10 +909,10 @@ public class Complex implements FieldElement<Complex>, Serializable {
|
||||||
* where the (real) functions on the right-hand side are
|
* where the (real) functions on the right-hand side are
|
||||||
* {@link FastMath#sin}, {@link FastMath#cos},
|
* {@link FastMath#sin}, {@link FastMath#cos},
|
||||||
* {@link FastMath#cosh} and {@link FastMath#sinh}.
|
* {@link FastMath#cosh} and {@link FastMath#sinh}.
|
||||||
* <br/>
|
* <p>
|
||||||
* Returns {@link Complex#NaN} if either real or imaginary part of the
|
* Returns {@link Complex#NaN} if either real or imaginary part of the
|
||||||
* input argument is {@code NaN}.
|
* input argument is {@code NaN}.
|
||||||
* <br/>
|
* </p><p>
|
||||||
* Infinite values in real or imaginary parts of the input may result in
|
* Infinite values in real or imaginary parts of the input may result in
|
||||||
* infinite or {@code NaN} values returned in parts of the result.
|
* infinite or {@code NaN} values returned in parts of the result.
|
||||||
* <pre>
|
* <pre>
|
||||||
|
@ -967,10 +949,10 @@ public class Complex implements FieldElement<Complex>, Serializable {
|
||||||
* where the (real) functions on the right-hand side are
|
* where the (real) functions on the right-hand side are
|
||||||
* {@link FastMath#sin}, {@link FastMath#cos},
|
* {@link FastMath#sin}, {@link FastMath#cos},
|
||||||
* {@link FastMath#cosh} and {@link FastMath#sinh}.
|
* {@link FastMath#cosh} and {@link FastMath#sinh}.
|
||||||
* <br/>
|
* <p>
|
||||||
* Returns {@link Complex#NaN} if either real or imaginary part of the
|
* Returns {@link Complex#NaN} if either real or imaginary part of the
|
||||||
* input argument is {@code NaN}.
|
* input argument is {@code NaN}.
|
||||||
* <br/>
|
* </p><p>
|
||||||
* Infinite values in real or imaginary parts of the input may result in
|
* Infinite values in real or imaginary parts of the input may result in
|
||||||
* infinite or NaN values returned in parts of the result.
|
* infinite or NaN values returned in parts of the result.
|
||||||
* <pre>
|
* <pre>
|
||||||
|
@ -1008,10 +990,10 @@ public class Complex implements FieldElement<Complex>, Serializable {
|
||||||
* <li>{@code |a + bi| = }{@link Complex#abs}(a + bi)</li>
|
* <li>{@code |a + bi| = }{@link Complex#abs}(a + bi)</li>
|
||||||
* <li>{@code sign(b) = }{@link FastMath#copySign(double,double) copySign(1d, b)}
|
* <li>{@code sign(b) = }{@link FastMath#copySign(double,double) copySign(1d, b)}
|
||||||
* </ul>
|
* </ul>
|
||||||
* <br/>
|
* <p>
|
||||||
* Returns {@link Complex#NaN} if either real or imaginary part of the
|
* Returns {@link Complex#NaN} if either real or imaginary part of the
|
||||||
* input argument is {@code NaN}.
|
* input argument is {@code NaN}.
|
||||||
* <br/>
|
* </p>
|
||||||
* Infinite values in real or imaginary parts of the input may result in
|
* Infinite values in real or imaginary parts of the input may result in
|
||||||
* infinite or NaN values returned in parts of the result.
|
* infinite or NaN values returned in parts of the result.
|
||||||
* <pre>
|
* <pre>
|
||||||
|
@ -1053,10 +1035,10 @@ public class Complex implements FieldElement<Complex>, Serializable {
|
||||||
* number.
|
* number.
|
||||||
* Computes the result directly as
|
* Computes the result directly as
|
||||||
* {@code sqrt(ONE.subtract(z.multiply(z)))}.
|
* {@code sqrt(ONE.subtract(z.multiply(z)))}.
|
||||||
* <br/>
|
* <p>
|
||||||
* Returns {@link Complex#NaN} if either real or imaginary part of the
|
* Returns {@link Complex#NaN} if either real or imaginary part of the
|
||||||
* input argument is {@code NaN}.
|
* input argument is {@code NaN}.
|
||||||
* <br/>
|
* </p>
|
||||||
* Infinite values in real or imaginary parts of the input may result in
|
* Infinite values in real or imaginary parts of the input may result in
|
||||||
* infinite or NaN values returned in parts of the result.
|
* infinite or NaN values returned in parts of the result.
|
||||||
*
|
*
|
||||||
|
@ -1080,10 +1062,10 @@ public class Complex implements FieldElement<Complex>, Serializable {
|
||||||
* where the (real) functions on the right-hand side are
|
* where the (real) functions on the right-hand side are
|
||||||
* {@link FastMath#sin}, {@link FastMath#cos}, {@link FastMath#cosh} and
|
* {@link FastMath#sin}, {@link FastMath#cos}, {@link FastMath#cosh} and
|
||||||
* {@link FastMath#sinh}.
|
* {@link FastMath#sinh}.
|
||||||
* <br/>
|
* <p>
|
||||||
* Returns {@link Complex#NaN} if either real or imaginary part of the
|
* Returns {@link Complex#NaN} if either real or imaginary part of the
|
||||||
* input argument is {@code NaN}.
|
* input argument is {@code NaN}.
|
||||||
* <br/>
|
* </p>
|
||||||
* Infinite (or critical) values in real or imaginary parts of the input may
|
* Infinite (or critical) values in real or imaginary parts of the input may
|
||||||
* result in infinite or NaN values returned in parts of the result.
|
* result in infinite or NaN values returned in parts of the result.
|
||||||
* <pre>
|
* <pre>
|
||||||
|
@ -1131,10 +1113,10 @@ public class Complex implements FieldElement<Complex>, Serializable {
|
||||||
* where the (real) functions on the right-hand side are
|
* where the (real) functions on the right-hand side are
|
||||||
* {@link FastMath#sin}, {@link FastMath#cos}, {@link FastMath#cosh} and
|
* {@link FastMath#sin}, {@link FastMath#cos}, {@link FastMath#cosh} and
|
||||||
* {@link FastMath#sinh}.
|
* {@link FastMath#sinh}.
|
||||||
* <br/>
|
* <p>
|
||||||
* Returns {@link Complex#NaN} if either real or imaginary part of the
|
* Returns {@link Complex#NaN} if either real or imaginary part of the
|
||||||
* input argument is {@code NaN}.
|
* input argument is {@code NaN}.
|
||||||
* <br/>
|
* </p>
|
||||||
* Infinite values in real or imaginary parts of the input may result in
|
* Infinite values in real or imaginary parts of the input may result in
|
||||||
* infinite or NaN values returned in parts of the result.
|
* infinite or NaN values returned in parts of the result.
|
||||||
* <pre>
|
* <pre>
|
||||||
|
@ -1177,7 +1159,7 @@ public class Complex implements FieldElement<Complex>, Serializable {
|
||||||
* The value returned is between -PI (not inclusive)
|
* The value returned is between -PI (not inclusive)
|
||||||
* and PI (inclusive), with negative values returned for numbers with
|
* and PI (inclusive), with negative values returned for numbers with
|
||||||
* negative imaginary parts.
|
* negative imaginary parts.
|
||||||
* <br/>
|
* <p>
|
||||||
* If either real or imaginary part (or both) is NaN, NaN is returned.
|
* If either real or imaginary part (or both) is NaN, NaN is returned.
|
||||||
* Infinite parts are handled as {@code Math.atan2} handles them,
|
* Infinite parts are handled as {@code Math.atan2} handles them,
|
||||||
* essentially treating finite parts as zero in the presence of an
|
* essentially treating finite parts as zero in the presence of an
|
||||||
|
@ -1202,14 +1184,14 @@ public class Complex implements FieldElement<Complex>, Serializable {
|
||||||
* for <i>{@code k=0, 1, ..., n-1}</i>, where {@code abs} and {@code phi}
|
* for <i>{@code k=0, 1, ..., n-1}</i>, where {@code abs} and {@code phi}
|
||||||
* are respectively the {@link #abs() modulus} and
|
* are respectively the {@link #abs() modulus} and
|
||||||
* {@link #getArgument() argument} of this complex number.
|
* {@link #getArgument() argument} of this complex number.
|
||||||
* <br/>
|
* <p>
|
||||||
* If one or both parts of this complex number is NaN, a list with just
|
* If one or both parts of this complex number is NaN, a list with just
|
||||||
* one element, {@link #NaN} is returned.
|
* one element, {@link #NaN} is returned.
|
||||||
* if neither part is NaN, but at least one part is infinite, the result
|
* if neither part is NaN, but at least one part is infinite, the result
|
||||||
* is a one-element list containing {@link #INF}.
|
* is a one-element list containing {@link #INF}.
|
||||||
*
|
*
|
||||||
* @param n Degree of root.
|
* @param n Degree of root.
|
||||||
* @return a List<Complex> of all {@code n}-th roots of {@code this}.
|
* @return a List of all {@code n}-th roots of {@code this}.
|
||||||
* @throws NotPositiveException if {@code n <= 0}.
|
* @throws NotPositiveException if {@code n <= 0}.
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -187,7 +187,6 @@ public abstract class BitsStreamGenerator
|
||||||
*
|
*
|
||||||
* @param bytes Array in which to put the generated bytes. Cannot be {@code null}.
|
* @param bytes Array in which to put the generated bytes. Cannot be {@code null}.
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public void nextBytes(byte[] bytes) {
|
public void nextBytes(byte[] bytes) {
|
||||||
nextBytesFill(bytes, 0, bytes.length);
|
nextBytesFill(bytes, 0, bytes.length);
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,8 @@ public class Precision {
|
||||||
* @param eps the amount of error to allow when checking for equality
|
* @param eps the amount of error to allow when checking for equality
|
||||||
* @return <ul><li>0 if {@link #equals(double, double, double) equals(x, y, eps)}</li>
|
* @return <ul><li>0 if {@link #equals(double, double, double) equals(x, y, eps)}</li>
|
||||||
* <li>< 0 if !{@link #equals(double, double, double) equals(x, y, eps)} && x < y</li>
|
* <li>< 0 if !{@link #equals(double, double, double) equals(x, y, eps)} && x < y</li>
|
||||||
* <li>> 0 if !{@link #equals(double, double, double) equals(x, y, eps)} && x > y</li></ul>
|
* <li>> 0 if !{@link #equals(double, double, double) equals(x, y, eps)} && x > y or
|
||||||
|
* either argument is NaN</li></ul>
|
||||||
*/
|
*/
|
||||||
public static int compareTo(double x, double y, double eps) {
|
public static int compareTo(double x, double y, double eps) {
|
||||||
if (equals(x, y, eps)) {
|
if (equals(x, y, eps)) {
|
||||||
|
@ -117,7 +118,7 @@ public class Precision {
|
||||||
* point numbers are considered equal.
|
* point numbers are considered equal.
|
||||||
* Adapted from <a
|
* Adapted from <a
|
||||||
* href="http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/">
|
* href="http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/">
|
||||||
* Bruce Dawson</a>
|
* Bruce Dawson</a>. Returns {@code false} if either of the arguments is NaN.
|
||||||
*
|
*
|
||||||
* @param x first value
|
* @param x first value
|
||||||
* @param y second value
|
* @param y second value
|
||||||
|
@ -125,7 +126,8 @@ public class Precision {
|
||||||
* values between {@code x} and {@code y}.
|
* values between {@code x} and {@code y}.
|
||||||
* @return <ul><li>0 if {@link #equals(double, double, int) equals(x, y, maxUlps)}</li>
|
* @return <ul><li>0 if {@link #equals(double, double, int) equals(x, y, maxUlps)}</li>
|
||||||
* <li>< 0 if !{@link #equals(double, double, int) equals(x, y, maxUlps)} && x < y</li>
|
* <li>< 0 if !{@link #equals(double, double, int) equals(x, y, maxUlps)} && x < y</li>
|
||||||
* <li>> 0 if !{@link #equals(double, double, int) equals(x, y, maxUlps)} && x > y</li></ul>
|
* <li>> 0 if !{@link #equals(double, double, int) equals(x, y, maxUlps)} && x > y
|
||||||
|
* or either argument is NaN</li></ul>
|
||||||
*/
|
*/
|
||||||
public static int compareTo(final double x, final double y, final int maxUlps) {
|
public static int compareTo(final double x, final double y, final int maxUlps) {
|
||||||
if (equals(x, y, maxUlps)) {
|
if (equals(x, y, maxUlps)) {
|
||||||
|
@ -149,7 +151,7 @@ public class Precision {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if both arguments are NaN or neither is NaN and they are
|
* Returns true if both arguments are NaN or they are
|
||||||
* equal as defined by {@link #equals(float,float) equals(x, y, 1)}.
|
* equal as defined by {@link #equals(float,float) equals(x, y, 1)}.
|
||||||
*
|
*
|
||||||
* @param x first value
|
* @param x first value
|
||||||
|
@ -162,8 +164,9 @@ public class Precision {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if both arguments are equal or within the range of allowed
|
* Returns true if the arguments are equal or within the range of allowed
|
||||||
* error (inclusive).
|
* error (inclusive). Returns {@code false} if either of the arguments
|
||||||
|
* is NaN.
|
||||||
*
|
*
|
||||||
* @param x first value
|
* @param x first value
|
||||||
* @param y second value
|
* @param y second value
|
||||||
|
@ -176,7 +179,7 @@ public class Precision {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if both arguments are NaN or are equal or within the range
|
* Returns true if the arguments are both NaN, are equal, or are within the range
|
||||||
* of allowed error (inclusive).
|
* of allowed error (inclusive).
|
||||||
*
|
*
|
||||||
* @param x first value
|
* @param x first value
|
||||||
|
@ -191,14 +194,14 @@ public class Precision {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if both arguments are equal or within the range of allowed
|
* Returns true if the arguments are equal or within the range of allowed
|
||||||
* error (inclusive).
|
* error (inclusive).
|
||||||
* Two float numbers are considered equal if there are {@code (maxUlps - 1)}
|
* Two float numbers are considered equal if there are {@code (maxUlps - 1)}
|
||||||
* (or fewer) floating point numbers between them, i.e. two adjacent floating
|
* (or fewer) floating point numbers between them, i.e. two adjacent floating
|
||||||
* point numbers are considered equal.
|
* point numbers are considered equal.
|
||||||
* Adapted from <a
|
* Adapted from <a
|
||||||
* href="http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/">
|
* href="http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/">
|
||||||
* Bruce Dawson</a>
|
* Bruce Dawson</a>. Returns {@code false} if either of the arguments is NaN.
|
||||||
*
|
*
|
||||||
* @param x first value
|
* @param x first value
|
||||||
* @param y second value
|
* @param y second value
|
||||||
|
@ -242,7 +245,7 @@ public class Precision {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if both arguments are NaN or if they are equal as defined
|
* Returns true if the arguments are both NaN or if they are equal as defined
|
||||||
* by {@link #equals(float,float,int) equals(x, y, maxUlps)}.
|
* by {@link #equals(float,float,int) equals(x, y, maxUlps)}.
|
||||||
*
|
*
|
||||||
* @param x first value
|
* @param x first value
|
||||||
|
@ -270,7 +273,7 @@ public class Precision {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if both arguments are NaN or neither is NaN and they are
|
* Returns true if the arguments are both NaN or they are
|
||||||
* equal as defined by {@link #equals(double,double) equals(x, y, 1)}.
|
* equal as defined by {@link #equals(double,double) equals(x, y, 1)}.
|
||||||
*
|
*
|
||||||
* @param x first value
|
* @param x first value
|
||||||
|
@ -285,7 +288,8 @@ public class Precision {
|
||||||
/**
|
/**
|
||||||
* Returns {@code true} if there is no double value strictly between the
|
* Returns {@code true} if there is no double value strictly between the
|
||||||
* arguments or the difference between them is within the range of allowed
|
* arguments or the difference between them is within the range of allowed
|
||||||
* error (inclusive).
|
* error (inclusive). Returns {@code false} if either of the arguments
|
||||||
|
* is NaN.
|
||||||
*
|
*
|
||||||
* @param x First value.
|
* @param x First value.
|
||||||
* @param y Second value.
|
* @param y Second value.
|
||||||
|
@ -299,8 +303,9 @@ public class Precision {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns {@code true} if there is no double value strictly between the
|
* Returns {@code true} if there is no double value strictly between the
|
||||||
* arguments or the relative difference between them is smaller or equal
|
* arguments or the relative difference between them is less than or equal
|
||||||
* to the given tolerance.
|
* to the given tolerance. Returns {@code false} if either of the arguments
|
||||||
|
* is NaN.
|
||||||
*
|
*
|
||||||
* @param x First value.
|
* @param x First value.
|
||||||
* @param y Second value.
|
* @param y Second value.
|
||||||
|
@ -321,7 +326,7 @@ public class Precision {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if both arguments are NaN or are equal or within the range
|
* Returns true if the arguments are both NaN, are equal or are within the range
|
||||||
* of allowed error (inclusive).
|
* of allowed error (inclusive).
|
||||||
*
|
*
|
||||||
* @param x first value
|
* @param x first value
|
||||||
|
@ -336,7 +341,7 @@ public class Precision {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if both arguments are equal or within the range of allowed
|
* Returns true if the arguments are equal or within the range of allowed
|
||||||
* error (inclusive).
|
* error (inclusive).
|
||||||
* <p>
|
* <p>
|
||||||
* Two float numbers are considered equal if there are {@code (maxUlps - 1)}
|
* Two float numbers are considered equal if there are {@code (maxUlps - 1)}
|
||||||
|
@ -346,7 +351,7 @@ public class Precision {
|
||||||
* <p>
|
* <p>
|
||||||
* Adapted from <a
|
* Adapted from <a
|
||||||
* href="http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/">
|
* href="http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/">
|
||||||
* Bruce Dawson</a>
|
* Bruce Dawson</a>. Returns {@code false} if either of the arguments is NaN.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param x first value
|
* @param x first value
|
||||||
|
|
|
@ -915,10 +915,9 @@ new KendallsCorrelation().correlation(x, y)
|
||||||
<a href="http://www.jstatsoft.org/v39/i11/"> Computing the Two-Sided Kolmogorov-Smirnov
|
<a href="http://www.jstatsoft.org/v39/i11/"> Computing the Two-Sided Kolmogorov-Smirnov
|
||||||
Distribution</a> by Richard Simard and Pierre L'Ecuyer. In the 2-sample case, estimation
|
Distribution</a> by Richard Simard and Pierre L'Ecuyer. In the 2-sample case, estimation
|
||||||
by default depends on the number of data points. For small samples, the distribution
|
by default depends on the number of data points. For small samples, the distribution
|
||||||
is computed exactly; for moderately large samples a Monte Carlo procedure is used, and
|
is computed exactly and for large samples a numerical approximation of the Kolmogorov
|
||||||
for large samples a numerical approximation of the Kolmogorov distribution is used.
|
distribution is used. Methods to perform each type of p-value estimation are also exposed
|
||||||
Methods to perform each type of p-value estimation are also exposed directly. See
|
directly. See the class javadoc for details.</li>
|
||||||
the class javadoc for details.</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
@ -1237,7 +1236,7 @@ final double d = TestUtils.kolmogorovSmirnovStatistic(x, y);
|
||||||
TestUtils.exactP(d, x.length, y.length, false)
|
TestUtils.exactP(d, x.length, y.length, false)
|
||||||
</source>
|
</source>
|
||||||
assuming that the non-strict form of the null hypothesis is desired. Note, however,
|
assuming that the non-strict form of the null hypothesis is desired. Note, however,
|
||||||
that exact computation for anything but very small samples takes a very long time.
|
that exact computation for large samples takes a long time.
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -564,6 +564,15 @@ public class ComplexTest {
|
||||||
Assert.assertFalse(Complex.equals(x, y, tol2));
|
Assert.assertFalse(Complex.equals(x, y, tol2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFloatingPointEqualsWithAllowedDeltaNaN() {
|
||||||
|
final Complex x = new Complex(0, Double.NaN);
|
||||||
|
final Complex y = new Complex(Double.NaN, 0);
|
||||||
|
Assert.assertFalse(Complex.equals(x, Complex.ZERO, 0.1));
|
||||||
|
Assert.assertFalse(Complex.equals(x, x, 0.1));
|
||||||
|
Assert.assertFalse(Complex.equals(x, y, 0.1));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFloatingPointEqualsWithRelativeTolerance() {
|
public void testFloatingPointEqualsWithRelativeTolerance() {
|
||||||
final double tol = 1e-4;
|
final double tol = 1e-4;
|
||||||
|
@ -576,6 +585,15 @@ public class ComplexTest {
|
||||||
Assert.assertTrue(Complex.equalsWithRelativeTolerance(x, y, tol));
|
Assert.assertTrue(Complex.equalsWithRelativeTolerance(x, y, tol));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFloatingPointEqualsWithRelativeToleranceNaN() {
|
||||||
|
final Complex x = new Complex(0, Double.NaN);
|
||||||
|
final Complex y = new Complex(Double.NaN, 0);
|
||||||
|
Assert.assertFalse(Complex.equalsWithRelativeTolerance(x, Complex.ZERO, 0.1));
|
||||||
|
Assert.assertFalse(Complex.equalsWithRelativeTolerance(x, x, 0.1));
|
||||||
|
Assert.assertFalse(Complex.equalsWithRelativeTolerance(x, y, 0.1));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEqualsTrue() {
|
public void testEqualsTrue() {
|
||||||
Complex x = new Complex(3.0, 4.0);
|
Complex x = new Complex(3.0, 4.0);
|
||||||
|
|
|
@ -22,6 +22,7 @@ import org.apache.commons.math3.exception.NotANumberException;
|
||||||
import org.apache.commons.math3.exception.NotFiniteNumberException;
|
import org.apache.commons.math3.exception.NotFiniteNumberException;
|
||||||
import org.apache.commons.math3.exception.NotPositiveException;
|
import org.apache.commons.math3.exception.NotPositiveException;
|
||||||
import org.apache.commons.math3.util.FastMath;
|
import org.apache.commons.math3.util.FastMath;
|
||||||
|
import org.apache.commons.math3.util.Precision;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -173,7 +174,7 @@ public class EnumeratedIntegerDistributionTest {
|
||||||
public void testCreateFromIntegers() {
|
public void testCreateFromIntegers() {
|
||||||
final int[] data = new int[] {0, 1, 1, 2, 2, 2};
|
final int[] data = new int[] {0, 1, 1, 2, 2, 2};
|
||||||
EnumeratedIntegerDistribution distribution = new EnumeratedIntegerDistribution(data);
|
EnumeratedIntegerDistribution distribution = new EnumeratedIntegerDistribution(data);
|
||||||
Assert.assertEquals(0.5, distribution.probability(2), 0);
|
Assert.assertEquals(0.5, distribution.probability(2), Precision.EPSILON);
|
||||||
Assert.assertEquals(0.5, distribution.cumulativeProbability(1), 0);
|
Assert.assertEquals(0.5, distribution.cumulativeProbability(1), Precision.EPSILON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.commons.math3.exception.NumberIsTooSmallException;
|
||||||
import org.apache.commons.math3.util.Decimal64Field;
|
import org.apache.commons.math3.util.Decimal64Field;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class AdamsBashforthFieldIntegratorTest extends AbstractAdamsFieldIntegratorTest {
|
public class AdamsBashforthFieldIntegratorTest extends AdamsFieldIntegratorAbstractTest {
|
||||||
|
|
||||||
protected <T extends RealFieldElement<T>> AdamsFieldIntegrator<T>
|
protected <T extends RealFieldElement<T>> AdamsFieldIntegrator<T>
|
||||||
createIntegrator(Field<T> field, final int nSteps, final double minStep, final double maxStep,
|
createIntegrator(Field<T> field, final int nSteps, final double minStep, final double maxStep,
|
||||||
|
|
|
@ -40,7 +40,7 @@ import org.apache.commons.math3.util.FastMath;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public abstract class AbstractAdamsFieldIntegratorTest {
|
public abstract class AdamsFieldIntegratorAbstractTest {
|
||||||
|
|
||||||
protected abstract <T extends RealFieldElement<T>> AdamsFieldIntegrator<T>
|
protected abstract <T extends RealFieldElement<T>> AdamsFieldIntegrator<T>
|
||||||
createIntegrator(Field<T> field, final int nSteps, final double minStep, final double maxStep,
|
createIntegrator(Field<T> field, final int nSteps, final double minStep, final double maxStep,
|
|
@ -26,7 +26,7 @@ import org.apache.commons.math3.exception.NumberIsTooSmallException;
|
||||||
import org.apache.commons.math3.util.Decimal64Field;
|
import org.apache.commons.math3.util.Decimal64Field;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class AdamsMoultonFieldIntegratorTest extends AbstractAdamsFieldIntegratorTest {
|
public class AdamsMoultonFieldIntegratorTest extends AdamsFieldIntegratorAbstractTest {
|
||||||
|
|
||||||
protected <T extends RealFieldElement<T>> AdamsFieldIntegrator<T>
|
protected <T extends RealFieldElement<T>> AdamsFieldIntegrator<T>
|
||||||
createIntegrator(Field<T> field, final int nSteps, final double minStep, final double maxStep,
|
createIntegrator(Field<T> field, final int nSteps, final double minStep, final double maxStep,
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
|
||||||
import org.apache.commons.math3.util.Decimal64Field;
|
import org.apache.commons.math3.util.Decimal64Field;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class ClassicalRungKuttaFieldStepInterpolatorTest extends AbstractRungeKuttaFieldStepInterpolatorTest {
|
public class ClassicalRungKuttaFieldStepInterpolatorTest extends RungeKuttaFieldStepInterpolatorAbstractTest {
|
||||||
|
|
||||||
protected <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
|
protected <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
|
||||||
createInterpolator(Field<T> field, boolean forward, T[][] yDotK,
|
createInterpolator(Field<T> field, boolean forward, T[][] yDotK,
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.apache.commons.math3.Field;
|
||||||
import org.apache.commons.math3.RealFieldElement;
|
import org.apache.commons.math3.RealFieldElement;
|
||||||
import org.apache.commons.math3.util.Decimal64Field;
|
import org.apache.commons.math3.util.Decimal64Field;
|
||||||
|
|
||||||
public class ClassicalRungeKuttaFieldIntegratorTest extends AbstractRungeKuttaFieldIntegratorTest {
|
public class ClassicalRungeKuttaFieldIntegratorTest extends RungeKuttaFieldIntegratorAbstractTest {
|
||||||
|
|
||||||
protected <T extends RealFieldElement<T>> RungeKuttaFieldIntegrator<T>
|
protected <T extends RealFieldElement<T>> RungeKuttaFieldIntegrator<T>
|
||||||
createIntegrator(Field<T> field, T step) {
|
createIntegrator(Field<T> field, T step) {
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.apache.commons.math3.Field;
|
||||||
import org.apache.commons.math3.RealFieldElement;
|
import org.apache.commons.math3.RealFieldElement;
|
||||||
import org.apache.commons.math3.util.Decimal64Field;
|
import org.apache.commons.math3.util.Decimal64Field;
|
||||||
|
|
||||||
public class DormandPrince54FieldIntegratorTest extends AbstractEmbeddedRungeKuttaFieldIntegratorTest {
|
public class DormandPrince54FieldIntegratorTest extends EmbeddedRungeKuttaFieldIntegratorAbstractTest {
|
||||||
|
|
||||||
protected <T extends RealFieldElement<T>> EmbeddedRungeKuttaFieldIntegrator<T>
|
protected <T extends RealFieldElement<T>> EmbeddedRungeKuttaFieldIntegrator<T>
|
||||||
createIntegrator(Field<T> field, final double minStep, final double maxStep,
|
createIntegrator(Field<T> field, final double minStep, final double maxStep,
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
|
||||||
import org.apache.commons.math3.util.Decimal64Field;
|
import org.apache.commons.math3.util.Decimal64Field;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class DormandPrince54FieldStepInterpolatorTest extends AbstractRungeKuttaFieldStepInterpolatorTest {
|
public class DormandPrince54FieldStepInterpolatorTest extends RungeKuttaFieldStepInterpolatorAbstractTest {
|
||||||
|
|
||||||
protected <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
|
protected <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
|
||||||
createInterpolator(Field<T> field, boolean forward, T[][] yDotK,
|
createInterpolator(Field<T> field, boolean forward, T[][] yDotK,
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.apache.commons.math3.Field;
|
||||||
import org.apache.commons.math3.RealFieldElement;
|
import org.apache.commons.math3.RealFieldElement;
|
||||||
import org.apache.commons.math3.util.Decimal64Field;
|
import org.apache.commons.math3.util.Decimal64Field;
|
||||||
|
|
||||||
public class DormandPrince853FieldIntegratorTest extends AbstractEmbeddedRungeKuttaFieldIntegratorTest {
|
public class DormandPrince853FieldIntegratorTest extends EmbeddedRungeKuttaFieldIntegratorAbstractTest {
|
||||||
|
|
||||||
protected <T extends RealFieldElement<T>> EmbeddedRungeKuttaFieldIntegrator<T>
|
protected <T extends RealFieldElement<T>> EmbeddedRungeKuttaFieldIntegrator<T>
|
||||||
createIntegrator(Field<T> field, final double minStep, final double maxStep,
|
createIntegrator(Field<T> field, final double minStep, final double maxStep,
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
|
||||||
import org.apache.commons.math3.util.Decimal64Field;
|
import org.apache.commons.math3.util.Decimal64Field;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class DormandPrince853FieldStepInterpolatorTest extends AbstractRungeKuttaFieldStepInterpolatorTest {
|
public class DormandPrince853FieldStepInterpolatorTest extends RungeKuttaFieldStepInterpolatorAbstractTest {
|
||||||
|
|
||||||
protected <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
|
protected <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
|
||||||
createInterpolator(Field<T> field, boolean forward, T[][] yDotK,
|
createInterpolator(Field<T> field, boolean forward, T[][] yDotK,
|
||||||
|
|
|
@ -44,7 +44,7 @@ import org.apache.commons.math3.util.MathArrays;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest {
|
public abstract class EmbeddedRungeKuttaFieldIntegratorAbstractTest {
|
||||||
|
|
||||||
protected abstract <T extends RealFieldElement<T>> EmbeddedRungeKuttaFieldIntegrator<T>
|
protected abstract <T extends RealFieldElement<T>> EmbeddedRungeKuttaFieldIntegrator<T>
|
||||||
createIntegrator(Field<T> field, final double minStep, final double maxStep,
|
createIntegrator(Field<T> field, final double minStep, final double maxStep,
|
|
@ -22,7 +22,7 @@ import org.apache.commons.math3.Field;
|
||||||
import org.apache.commons.math3.RealFieldElement;
|
import org.apache.commons.math3.RealFieldElement;
|
||||||
import org.apache.commons.math3.util.Decimal64Field;
|
import org.apache.commons.math3.util.Decimal64Field;
|
||||||
|
|
||||||
public class EulerFieldIntegratorTest extends AbstractRungeKuttaFieldIntegratorTest {
|
public class EulerFieldIntegratorTest extends RungeKuttaFieldIntegratorAbstractTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <T extends RealFieldElement<T>> RungeKuttaFieldIntegrator<T>
|
protected <T extends RealFieldElement<T>> RungeKuttaFieldIntegrator<T>
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
|
||||||
import org.apache.commons.math3.util.Decimal64Field;
|
import org.apache.commons.math3.util.Decimal64Field;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class EulerFieldStepInterpolatorTest extends AbstractRungeKuttaFieldStepInterpolatorTest {
|
public class EulerFieldStepInterpolatorTest extends RungeKuttaFieldStepInterpolatorAbstractTest {
|
||||||
|
|
||||||
protected <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
|
protected <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
|
||||||
createInterpolator(Field<T> field, boolean forward, T[][] yDotK,
|
createInterpolator(Field<T> field, boolean forward, T[][] yDotK,
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.apache.commons.math3.Field;
|
||||||
import org.apache.commons.math3.RealFieldElement;
|
import org.apache.commons.math3.RealFieldElement;
|
||||||
import org.apache.commons.math3.util.Decimal64Field;
|
import org.apache.commons.math3.util.Decimal64Field;
|
||||||
|
|
||||||
public class GillFieldIntegratorTest extends AbstractRungeKuttaFieldIntegratorTest {
|
public class GillFieldIntegratorTest extends RungeKuttaFieldIntegratorAbstractTest {
|
||||||
|
|
||||||
protected <T extends RealFieldElement<T>> RungeKuttaFieldIntegrator<T>
|
protected <T extends RealFieldElement<T>> RungeKuttaFieldIntegrator<T>
|
||||||
createIntegrator(Field<T> field, T step) {
|
createIntegrator(Field<T> field, T step) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
|
||||||
import org.apache.commons.math3.util.Decimal64Field;
|
import org.apache.commons.math3.util.Decimal64Field;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class GillFieldStepInterpolatorTest extends AbstractRungeKuttaFieldStepInterpolatorTest {
|
public class GillFieldStepInterpolatorTest extends RungeKuttaFieldStepInterpolatorAbstractTest {
|
||||||
|
|
||||||
protected <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
|
protected <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
|
||||||
createInterpolator(Field<T> field, boolean forward, T[][] yDotK,
|
createInterpolator(Field<T> field, boolean forward, T[][] yDotK,
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.apache.commons.math3.Field;
|
||||||
import org.apache.commons.math3.RealFieldElement;
|
import org.apache.commons.math3.RealFieldElement;
|
||||||
import org.apache.commons.math3.util.Decimal64Field;
|
import org.apache.commons.math3.util.Decimal64Field;
|
||||||
|
|
||||||
public class HighamHall54FieldIntegratorTest extends AbstractEmbeddedRungeKuttaFieldIntegratorTest {
|
public class HighamHall54FieldIntegratorTest extends EmbeddedRungeKuttaFieldIntegratorAbstractTest {
|
||||||
|
|
||||||
protected <T extends RealFieldElement<T>> EmbeddedRungeKuttaFieldIntegrator<T>
|
protected <T extends RealFieldElement<T>> EmbeddedRungeKuttaFieldIntegrator<T>
|
||||||
createIntegrator(Field<T> field, final double minStep, final double maxStep,
|
createIntegrator(Field<T> field, final double minStep, final double maxStep,
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
|
||||||
import org.apache.commons.math3.util.Decimal64Field;
|
import org.apache.commons.math3.util.Decimal64Field;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class HighamHall54FieldStepInterpolatorTest extends AbstractRungeKuttaFieldStepInterpolatorTest {
|
public class HighamHall54FieldStepInterpolatorTest extends RungeKuttaFieldStepInterpolatorAbstractTest {
|
||||||
|
|
||||||
protected <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
|
protected <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
|
||||||
createInterpolator(Field<T> field, boolean forward, T[][] yDotK,
|
createInterpolator(Field<T> field, boolean forward, T[][] yDotK,
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.commons.math3.exception.NoBracketingException;
|
||||||
import org.apache.commons.math3.exception.NumberIsTooSmallException;
|
import org.apache.commons.math3.exception.NumberIsTooSmallException;
|
||||||
import org.apache.commons.math3.util.Decimal64Field;
|
import org.apache.commons.math3.util.Decimal64Field;
|
||||||
|
|
||||||
public class LutherFieldIntegratorTest extends AbstractRungeKuttaFieldIntegratorTest {
|
public class LutherFieldIntegratorTest extends RungeKuttaFieldIntegratorAbstractTest {
|
||||||
|
|
||||||
protected <T extends RealFieldElement<T>> RungeKuttaFieldIntegrator<T>
|
protected <T extends RealFieldElement<T>> RungeKuttaFieldIntegrator<T>
|
||||||
createIntegrator(Field<T> field, T step) {
|
createIntegrator(Field<T> field, T step) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
|
||||||
import org.apache.commons.math3.util.Decimal64Field;
|
import org.apache.commons.math3.util.Decimal64Field;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class LutherFieldStepInterpolatorTest extends AbstractRungeKuttaFieldStepInterpolatorTest {
|
public class LutherFieldStepInterpolatorTest extends RungeKuttaFieldStepInterpolatorAbstractTest {
|
||||||
|
|
||||||
protected <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
|
protected <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
|
||||||
createInterpolator(Field<T> field, boolean forward, T[][] yDotK,
|
createInterpolator(Field<T> field, boolean forward, T[][] yDotK,
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.apache.commons.math3.Field;
|
||||||
import org.apache.commons.math3.RealFieldElement;
|
import org.apache.commons.math3.RealFieldElement;
|
||||||
import org.apache.commons.math3.util.Decimal64Field;
|
import org.apache.commons.math3.util.Decimal64Field;
|
||||||
|
|
||||||
public class MidpointFieldIntegratorTest extends AbstractRungeKuttaFieldIntegratorTest {
|
public class MidpointFieldIntegratorTest extends RungeKuttaFieldIntegratorAbstractTest {
|
||||||
|
|
||||||
protected <T extends RealFieldElement<T>> RungeKuttaFieldIntegrator<T>
|
protected <T extends RealFieldElement<T>> RungeKuttaFieldIntegrator<T>
|
||||||
createIntegrator(Field<T> field, T step) {
|
createIntegrator(Field<T> field, T step) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
|
||||||
import org.apache.commons.math3.util.Decimal64Field;
|
import org.apache.commons.math3.util.Decimal64Field;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class MidpointFieldStepInterpolatorTest extends AbstractRungeKuttaFieldStepInterpolatorTest {
|
public class MidpointFieldStepInterpolatorTest extends RungeKuttaFieldStepInterpolatorAbstractTest {
|
||||||
|
|
||||||
protected <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
|
protected <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
|
||||||
createInterpolator(Field<T> field, boolean forward, T[][] yDotK,
|
createInterpolator(Field<T> field, boolean forward, T[][] yDotK,
|
||||||
|
|
|
@ -49,7 +49,7 @@ import org.apache.commons.math3.util.MathArrays;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public abstract class AbstractRungeKuttaFieldIntegratorTest {
|
public abstract class RungeKuttaFieldIntegratorAbstractTest {
|
||||||
|
|
||||||
protected abstract <T extends RealFieldElement<T>> RungeKuttaFieldIntegrator<T>
|
protected abstract <T extends RealFieldElement<T>> RungeKuttaFieldIntegrator<T>
|
||||||
createIntegrator(Field<T> field, T step);
|
createIntegrator(Field<T> field, T step);
|
|
@ -33,7 +33,7 @@ import org.apache.commons.math3.util.MathArrays;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public abstract class AbstractRungeKuttaFieldStepInterpolatorTest {
|
public abstract class RungeKuttaFieldStepInterpolatorAbstractTest {
|
||||||
|
|
||||||
protected abstract <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
|
protected abstract <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
|
||||||
createInterpolator(Field<T> field, boolean forward, T[][] yDotK,
|
createInterpolator(Field<T> field, boolean forward, T[][] yDotK,
|
|
@ -22,7 +22,7 @@ import org.apache.commons.math3.Field;
|
||||||
import org.apache.commons.math3.RealFieldElement;
|
import org.apache.commons.math3.RealFieldElement;
|
||||||
import org.apache.commons.math3.util.Decimal64Field;
|
import org.apache.commons.math3.util.Decimal64Field;
|
||||||
|
|
||||||
public class ThreeEighthesFieldIntegratorTest extends AbstractRungeKuttaFieldIntegratorTest {
|
public class ThreeEighthesFieldIntegratorTest extends RungeKuttaFieldIntegratorAbstractTest {
|
||||||
|
|
||||||
protected <T extends RealFieldElement<T>> RungeKuttaFieldIntegrator<T>
|
protected <T extends RealFieldElement<T>> RungeKuttaFieldIntegrator<T>
|
||||||
createIntegrator(Field<T> field, T step) {
|
createIntegrator(Field<T> field, T step) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
|
||||||
import org.apache.commons.math3.util.Decimal64Field;
|
import org.apache.commons.math3.util.Decimal64Field;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class ThreeEighthesFieldStepInterpolatorTest extends AbstractRungeKuttaFieldStepInterpolatorTest {
|
public class ThreeEighthesFieldStepInterpolatorTest extends RungeKuttaFieldStepInterpolatorAbstractTest {
|
||||||
|
|
||||||
protected <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
|
protected <T extends RealFieldElement<T>> RungeKuttaFieldStepInterpolator<T>
|
||||||
createInterpolator(Field<T> field, boolean forward, T[][] yDotK,
|
createInterpolator(Field<T> field, boolean forward, T[][] yDotK,
|
||||||
|
|
46
test-jar.xml
46
test-jar.xml
|
@ -21,25 +21,23 @@
|
||||||
Compiles and runs unit tests against distribution jar(s). Use .antrc or the
|
Compiles and runs unit tests against distribution jar(s). Use .antrc or the
|
||||||
command line to control the jdk used to execute this build file.
|
command line to control the jdk used to execute this build file.
|
||||||
|
|
||||||
Assumes that the distribution jar to be tested is in the base directory.
|
Assumes that the distribution jar to be tested is in the basedir/lib, along
|
||||||
Use the "jardir" property to specify the path to the directory containing
|
with any dependent jars (junit, hamcrest). Use the "libdir" property to specify
|
||||||
the jar. Any other jars in this directory will also be added to the
|
the path to the directory containing these jars.
|
||||||
classpath.
|
|
||||||
|
|
||||||
The default target, "test," executes clean as a dependency.
|
The default target, "test," executes clean as a dependency.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<project default="test" name="commons-math" basedir=".">
|
<project default="test" name="commons-math" basedir=".">
|
||||||
<property name="defaulttargetdir" value="target"/>
|
<property name="libdir" value="lib"/>
|
||||||
<property name="libdir" value="target/lib"/>
|
|
||||||
<property name="testclassesdir" value="target/test-classes"/>
|
<property name="testclassesdir" value="target/test-classes"/>
|
||||||
<property name="testreportdir" value="target/test-reports"/>
|
<property name="testreportdir" value="target/test-reports"/>
|
||||||
<property name="defaulttargetdir" value="target"/>
|
<property name="defaulttargetdir" value="target"/>
|
||||||
<property name="jardir" value="${basedir}"/>
|
<property name="test.resources" value="src/test/resources"/>
|
||||||
|
<property name="build.home" value="target"/>
|
||||||
<path id="build.classpath">
|
<path id="build.classpath">
|
||||||
<fileset dir="${libdir}">
|
<fileset dir="${libdir}">
|
||||||
<include name="**/*.jar">
|
<include name="*.jar" />
|
||||||
</include>
|
|
||||||
</fileset>
|
</fileset>
|
||||||
</path>
|
</path>
|
||||||
<target name="clean" description="o Clean up the generated directories">
|
<target name="clean" description="o Clean up the generated directories">
|
||||||
|
@ -58,24 +56,17 @@
|
||||||
Java library path: ${java.library.path}
|
Java library path: ${java.library.path}
|
||||||
===========================================================================
|
===========================================================================
|
||||||
</echo>
|
</echo>
|
||||||
<mkdir dir="${libdir}" />
|
|
||||||
<condition property="noget">
|
|
||||||
<equals arg2="only" arg1="${build.sysclasspath}">
|
|
||||||
</equals>
|
|
||||||
</condition>
|
|
||||||
<!--Test if JUNIT is present in ANT classpath-->
|
|
||||||
<available property="Junit.present" classname="org.junit.Test">
|
|
||||||
</available>
|
|
||||||
</target>
|
</target>
|
||||||
<target name="test" description="o Run the test cases" if="test.failure" depends="internal-test">
|
<target name="test" description="o Run the test cases" if="test.failure" depends="internal-test">
|
||||||
<fail message="There were test failures.">
|
<fail message="There were test failures.">
|
||||||
</fail>
|
</fail>
|
||||||
</target>
|
</target>
|
||||||
<target name="internal-test" if="Junit.present" depends="clean, junit-present,compile-tests">
|
<target name="internal-test" depends="clean,compile-tests">
|
||||||
<mkdir dir="${testreportdir}"/>
|
<mkdir dir="${testreportdir}"/>
|
||||||
<junit dir="./" failureproperty="test.failure" printSummary="yes" fork="true" haltonerror="true">
|
<junit dir="./" failureproperty="test.failure" printSummary="yes"
|
||||||
|
fork="true" haltonerror="true" showOutput="true">
|
||||||
<sysproperty key="basedir" value="."/>
|
<sysproperty key="basedir" value="."/>
|
||||||
<formatter usefile="false" type="plain"/>
|
<formatter type="brief"/>
|
||||||
<classpath>
|
<classpath>
|
||||||
<path refid="build.classpath"/>
|
<path refid="build.classpath"/>
|
||||||
<pathelement path="${testclassesdir}"/>
|
<pathelement path="${testclassesdir}"/>
|
||||||
|
@ -88,14 +79,7 @@
|
||||||
</batchtest>
|
</batchtest>
|
||||||
</junit>
|
</junit>
|
||||||
</target>
|
</target>
|
||||||
<target name="junit-present" unless="Junit.present" depends="init">
|
<target name="compile-tests" >
|
||||||
<echo>
|
|
||||||
================================= WARNING ================================
|
|
||||||
Junit isn't present in your ${ANT_HOME}/lib directory. Tests not executed.
|
|
||||||
==========================================================================
|
|
||||||
</echo>
|
|
||||||
</target>
|
|
||||||
<target name="compile-tests" if="Junit.present" depends="junit-present">
|
|
||||||
<mkdir dir="${testclassesdir}"/>
|
<mkdir dir="${testclassesdir}"/>
|
||||||
<javac destdir="${testclassesdir}" deprecation="true" debug="true"
|
<javac destdir="${testclassesdir}" deprecation="true" debug="true"
|
||||||
optimize="false" excludes="**/package.html">
|
optimize="false" excludes="**/package.html">
|
||||||
|
@ -106,10 +90,8 @@
|
||||||
<path refid="build.classpath"/>
|
<path refid="build.classpath"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
</javac>
|
</javac>
|
||||||
<copy todir="${testclassesdir}">
|
<copy todir="${build.home}/test-classes">
|
||||||
<fileset dir="src/test/resources">
|
<fileset dir="${test.resources}">
|
||||||
<include name="**/*.xml"/>
|
|
||||||
<include name="**/*.txt"/>
|
|
||||||
</fileset>
|
</fileset>
|
||||||
</copy>
|
</copy>
|
||||||
</target>
|
</target>
|
||||||
|
|
Loading…
Reference in New Issue