commons-numbers.git
3 weeks agoJavadoc typo master
aherbert [Wed, 4 May 2022 17:08:03 +0000 (18:08 +0100)] 
Javadoc typo

3 weeks agoSonar fix: Use constants in place of methods for constant values
aherbert [Wed, 4 May 2022 17:06:33 +0000 (18:06 +0100)] 
Sonar fix: Use constants in place of methods for constant values

3 weeks agoSonar fix: custom assertEquals method so that expected can be last
aherbert [Wed, 4 May 2022 17:02:18 +0000 (18:02 +0100)] 
Sonar fix: custom assertEquals method so that expected can be last

3 weeks agoSonar fix: Extract nested ternary
aherbert [Wed, 4 May 2022 16:55:04 +0000 (17:55 +0100)] 
Sonar fix: Extract nested ternary

3 weeks agoSonar fix: remove useless assignment
aherbert [Wed, 4 May 2022 16:50:31 +0000 (17:50 +0100)] 
Sonar fix: remove useless assignment

4 weeks agoRemove extra new lines
aherbert [Mon, 25 Apr 2022 11:52:12 +0000 (12:52 +0100)] 
Remove extra new lines

4 weeks agoJavadoc typo
aherbert [Mon, 25 Apr 2022 11:47:22 +0000 (12:47 +0100)] 
Javadoc typo

2 months agoAdd SECURITY.md
Gary Gregory [Fri, 25 Feb 2022 13:23:07 +0000 (08:23 -0500)] 
Add SECURITY.md

2 months agoAdd CODE_OF_CONDUCT.md
Gary Gregory [Fri, 25 Feb 2022 13:18:48 +0000 (08:18 -0500)] 
Add CODE_OF_CONDUCT.md

3 months agoNUMBERS-185: Allow Precision.compareTo using a max ULP to be used for
aherbert [Wed, 16 Feb 2022 13:44:41 +0000 (13:44 +0000)] 
NUMBERS-185: Allow Precision.compareTo using a max ULP to be used for
sorting.

Updated tests to ensure compareTo is symmetric for the arguments.

Updated the documentation to state expected behaviour with NaN
arguments.

3 months agoUse Double.MIN_VALUE for the SAFE_MIN constant.
aherbert [Wed, 16 Feb 2022 12:33:14 +0000 (12:33 +0000)] 
Use Double.MIN_VALUE for the SAFE_MIN constant.

3 months agoEnsure Precision equals is symmetric
aherbert [Wed, 16 Feb 2022 12:32:30 +0000 (12:32 +0000)] 
Ensure Precision equals is symmetric

Update the tests to use an interface that asserts the return value is
the same when arguments are reversed.

3 months agoNUMBERS-184: Reduce operations in Precision.equals using a maxUlps
aherbert [Wed, 16 Feb 2022 11:29:38 +0000 (11:29 +0000)] 
NUMBERS-184: Reduce operations in Precision.equals using a maxUlps

4 months agoReplace deprecated calls.
Gilles Sadowski [Sun, 23 Jan 2022 23:02:03 +0000 (00:02 +0100)] 
Replace deprecated calls.

4 months agoUpgrade parent POM.
Gilles Sadowski [Sun, 23 Jan 2022 23:01:17 +0000 (00:01 +0100)] 
Upgrade parent POM.

4 months agoNUMBERS-181: Track changes
Alex Herbert [Sat, 22 Jan 2022 13:12:50 +0000 (13:12 +0000)] 
NUMBERS-181: Track changes

4 months agoNUMBERS-181: New public API for beta functions
Alex Herbert [Thu, 20 Jan 2022 23:17:31 +0000 (23:17 +0000)] 
NUMBERS-181: New public API for beta functions

4 months agoNUMBERS-181: Port the Boost beta functions
Alex Herbert [Wed, 5 Jan 2022 23:49:59 +0000 (23:49 +0000)] 
NUMBERS-181: Port the Boost beta functions

4 months agoMove DataReader to package level class
Alex Herbert [Tue, 4 Jan 2022 23:06:33 +0000 (23:06 +0000)] 
Move DataReader to package level class

4 months agoMove BoostGamma.Policy to package level class
Alex Herbert [Tue, 4 Jan 2022 21:17:50 +0000 (21:17 +0000)] 
Move BoostGamma.Policy to package level class

4 months agoNUMBERS-183: Track changes
aherbert [Thu, 20 Jan 2022 15:51:09 +0000 (15:51 +0000)] 
NUMBERS-183: Track changes

4 months agoNUMBERS-183: Improve binomial coefficient classes
aherbert [Thu, 20 Jan 2022 14:58:26 +0000 (14:58 +0000)] 
NUMBERS-183: Improve binomial coefficient classes

Refactor the tests to use JUnit 5 parameterized test features.

Refactor the test for all binomial coefficients up to n=200 to compute
the result using n! / (n-k)! / k!. Removes the caching test
implementation which only works for results within a long datatype. This
has been updated for BinomialCoefficientDouble and
LogBinomialCoefficient to test the result is correct even when a long
overflows.

Update the implementations:

- Avoid recursive method call if k > n/2.

- Add early exit if the result cannot fit into the output datatype. This
is k >= 34 for long, and k >= 515 for a double.

- BinomialCoefficientDouble: Use the precomputed factorials to compute
n! / k! / (n-k)! if possible.

- BinomialCoefficientDouble: avoid overflow by checking the intermediate
result

- LogBinomialCoefficient: Compute the terms using the LogBeta class

4 months agoUpdate NOTICE to 2022
aherbert [Thu, 20 Jan 2022 10:18:26 +0000 (10:18 +0000)] 
Update NOTICE to 2022

4 months agoNUMBERS-182: Avoid overflow in LogBeta for tiny arguments
Alex Herbert [Sat, 8 Jan 2022 09:23:32 +0000 (09:23 +0000)] 
NUMBERS-182: Avoid overflow in LogBeta for tiny arguments

5 months agoNUMBERS-180: Track changes
Alex Herbert [Thu, 23 Dec 2021 21:46:44 +0000 (21:46 +0000)] 
NUMBERS-180: Track changes

5 months agoNUMBERS-180: Gamma ratio and delta ratio
Alex Herbert [Wed, 22 Dec 2021 08:37:14 +0000 (08:37 +0000)] 
NUMBERS-180: Gamma ratio and delta ratio

Added support for the ratio of two gamma functions. Copied the test
data from the source Boost implementation.

5 months agoRemove public from package level utility class
Alex Herbert [Thu, 23 Dec 2021 13:03:51 +0000 (13:03 +0000)] 
Remove public from package level utility class

5 months agoRemove redundant variable assignment
aherbert [Thu, 16 Dec 2021 16:34:00 +0000 (16:34 +0000)] 
Remove redundant variable assignment

Use e directly and update to d in the condition that accepts the
interpolation. The condition that rejects interpolation updates e
anyway.

5 months agoRemove dependency on Precision
aherbert [Thu, 16 Dec 2021 16:32:51 +0000 (16:32 +0000)] 
Remove dependency on Precision

Since this was used to compare to zero the method can be more simply
implemented:

Precision.equals(b, 0) == Math.abs(b) <= Double.MIN_VALUE

5 months agoAvoid underflow computing the initial value
aherbert [Thu, 16 Dec 2021 14:08:36 +0000 (14:08 +0000)] 
Avoid underflow computing the initial value

This is an extreme edge case for the solver called with no bracketing.
It ensures the bracket can be used to return a value if within the
current function accuracy tolerance.

5 months agoAvoid overflow computing the initial value
aherbert [Thu, 16 Dec 2021 11:38:24 +0000 (11:38 +0000)] 
Avoid overflow computing the initial value

5 months agoNUMBERS-179: Update threshold in regularisedGammaPrefix
Alex Herbert [Tue, 14 Dec 2021 18:04:27 +0000 (18:04 +0000)] 
NUMBERS-179: Update threshold in regularisedGammaPrefix

Modifies the threshold from a > 150 (Boost version) to a > 128.

5 months agoLower threshold for a ~ z
Alex Herbert [Mon, 13 Dec 2021 08:25:15 +0000 (08:25 +0000)] 
Lower threshold for a ~ z

This threshold requires optimisation. The threshold was too high to pass
existing tests in Commons Statistics (see STATISTICS-39).

5 months agoMove the direct computation before checks for base near 1
Alex Herbert [Mon, 13 Dec 2021 00:10:54 +0000 (00:10 +0000)] 
Move the direct computation before checks for base near 1

When the direct computation can be used then there is no requirement for
the Lanczos code that uses pow(z / (z+g-0.5), a). Thus there is no need
to avoid a base near 1 in the power function. This check only applies
after the direct computation has been eliminated.

5 months agoAdd another log1pmx test case to hit code coverage
aherbert [Wed, 8 Dec 2021 15:54:11 +0000 (15:54 +0000)] 
Add another log1pmx test case to hit code coverage

5 months agoNUMBERS-177: Add scaled complementary error function Erfcx
Alex Herbert [Mon, 6 Dec 2021 08:34:26 +0000 (08:34 +0000)] 
NUMBERS-177: Add scaled complementary error function Erfcx

Updates the rational function approximation for erfc(x > 4) to a
function valid for the approximation limit of erfcx (x ~ 6.71e7).

Improves the scaling by exp(-x*x) and exp(x*x).

5 months agoNUMBERS-178: Add Factorial.doubleValue(int)
Alex Herbert [Sat, 4 Dec 2021 00:52:12 +0000 (00:52 +0000)] 
NUMBERS-178: Add Factorial.doubleValue(int)

Deprecate the FactorialDouble class.

5 months agoAdd since tags for new API additions
Alex Herbert [Fri, 3 Dec 2021 23:06:42 +0000 (23:06 +0000)] 
Add since tags for new API additions

5 months agoNUMBERS-178: Tabulate all representable factorials in FactorialDouble
aherbert [Fri, 3 Dec 2021 13:47:57 +0000 (13:47 +0000)] 
NUMBERS-178: Tabulate all representable factorials in FactorialDouble

Values are verified using BigInteger computation of n!

This change deprecates the now redundant caching functionality.

5 months agoAdd Commons Numbers 1.0 implementation to ErfPerformance benchmark
aherbert [Tue, 30 Nov 2021 11:30:01 +0000 (11:30 +0000)] 
Add Commons Numbers 1.0 implementation to ErfPerformance benchmark

Previously the code called RegularizedGamma.P or Q. Since these have
been updated the 1.0 version has been preserved for a reference
benchmark.

5 months agoUpdate Commons RNG from 1.3 to 1.4
aherbert [Mon, 29 Nov 2021 18:09:27 +0000 (18:09 +0000)] 
Update Commons RNG from 1.3 to 1.4

5 months agoNUMBERS-176: ContinuedFraction delegates to GeneralizedContinuedFraction
aherbert [Wed, 24 Nov 2021 14:15:11 +0000 (14:15 +0000)] 
NUMBERS-176: ContinuedFraction delegates to GeneralizedContinuedFraction

5 months agoNUMBERS-174: Track changes
aherbert [Mon, 29 Nov 2021 15:55:29 +0000 (15:55 +0000)] 
NUMBERS-174: Track changes

6 months agoNUMBERS-174: Update gamma functions public API 110/head
Alex Herbert [Tue, 16 Nov 2021 16:42:16 +0000 (16:42 +0000)] 
NUMBERS-174: Update gamma functions public API

Use the Boost gamma function implementations.

Add new IncompleteGamma class and tests.

Add LogGamma with a sign output.

Update the test data for Gamma and tighten the tolerances for the
improved function. The data is not duplicated from the Boost test data.

Remove obsolete tests for RegularizedGamma.

Add Gamma P and Q derivative.

6 months agoNUMBERS-174: Use Boost gamma function implementation
Alex Herbert [Tue, 26 Oct 2021 20:43:27 +0000 (21:43 +0100)] 
NUMBERS-174: Use Boost gamma function implementation

6 months agoAdd usable maven modules to the main README.md page
aherbert [Wed, 24 Nov 2021 12:59:43 +0000 (12:59 +0000)] 
Add usable maven modules to the main README.md page

This replaces the example for commons-numbers-parent

6 months agoTest isPowerOfTwo with negative arguments and all true powers up to 2^62
aherbert [Wed, 24 Nov 2021 12:54:45 +0000 (12:54 +0000)] 
Test isPowerOfTwo with negative arguments and all true powers up to 2^62

6 months agoNUMBERS-175: Track changes
aherbert [Wed, 24 Nov 2021 12:56:54 +0000 (12:56 +0000)] 
NUMBERS-175: Track changes

6 months agoNUMBERS-175: A continued fraction class to compute using a generator 109/head
aherbert [Wed, 17 Nov 2021 18:27:00 +0000 (18:27 +0000)] 
NUMBERS-175: A continued fraction class to compute using a generator

Added a GeneralizedContinuedFraction class. This has evaluation methods
to include or exclude the leading term b0.

6 months agoChange Travis CI openjdk9 to openjdk11
aherbert [Wed, 24 Nov 2021 10:24:27 +0000 (10:24 +0000)] 
Change Travis CI openjdk9 to openjdk11

openjdk9 is no longer supported on Travis CI

6 months agoReuse the golden ratio continued fraction implementation.
aherbert [Tue, 2 Nov 2021 10:54:32 +0000 (10:54 +0000)] 
Reuse the golden ratio continued fraction implementation.

6 months agoNUMBERS-173: Set minimum bound on continued fraction epsilon
aherbert [Tue, 2 Nov 2021 10:48:35 +0000 (10:48 +0000)] 
NUMBERS-173: Set minimum bound on continued fraction epsilon

6 months agoSonar fix: Use assertEquals
Alex Herbert [Wed, 27 Oct 2021 11:21:57 +0000 (12:21 +0100)] 
Sonar fix: Use assertEquals

6 months agoSonar fix: lambda to contain only one source of an exception
Alex Herbert [Wed, 27 Oct 2021 11:19:47 +0000 (12:19 +0100)] 
Sonar fix: lambda to contain only one source of an exception

6 months agoCorrect javadoc
Alex Herbert [Tue, 26 Oct 2021 20:46:55 +0000 (21:46 +0100)] 
Correct javadoc

6 months agoPrevent caching infinite factorial values.
aherbert [Tue, 26 Oct 2021 10:19:42 +0000 (11:19 +0100)] 
Prevent caching infinite factorial values.

6 months agoUse String.format when doubles are used in messages.
aherbert [Tue, 26 Oct 2021 10:02:46 +0000 (11:02 +0100)] 
Use String.format when doubles are used in messages.

MessageFormat.format by default will represent numbers with too low a
precision. E.g. nextUp(1.5) is 1.5 not 1.5000000000000002.

6 months agoUse isFinite
aherbert [Tue, 26 Oct 2021 09:42:20 +0000 (10:42 +0100)] 
Use isFinite

7 months agoUpdate ErfDifference X_CRIT value
Alex Herbert [Fri, 22 Oct 2021 00:11:16 +0000 (01:11 +0100)] 
Update ErfDifference X_CRIT value

7 months agoTrack changes
Alex Herbert [Thu, 21 Oct 2021 08:40:59 +0000 (09:40 +0100)] 
Track changes

7 months agoUpdate test tolerances for Erf and Erfc tests 108/head
Alex Herbert [Wed, 20 Oct 2021 20:48:54 +0000 (21:48 +0100)] 
Update test tolerances for Erf and Erfc tests

Tolerances can be made stricter following the accuracy improvement of
the error functions in NUMBERS-172.

7 months agoIncrease test coverage for RegularizedGamma
Alex Herbert [Wed, 20 Oct 2021 08:03:14 +0000 (09:03 +0100)] 
Increase test coverage for RegularizedGamma

7 months agoNUMBERS-172: Use Boost Error function implementation
Alex Herbert [Thu, 14 Oct 2021 07:21:15 +0000 (08:21 +0100)] 
NUMBERS-172: Use Boost Error function implementation

Replace the use of the regularized gamma functions P and Q to evaluate
the error function.

7 months agoExclude spot bugs false positives
Alex Herbert [Wed, 20 Oct 2021 21:57:43 +0000 (22:57 +0100)] 
Exclude spot bugs false positives

7 months agoUpdate gitignore to exclude all target directories
Alex Herbert [Wed, 20 Oct 2021 21:50:09 +0000 (22:50 +0100)] 
Update gitignore to exclude all target directories

7 months agoUpgrade plugins to allow building on JDK 17.
Alex Herbert [Wed, 20 Oct 2021 21:27:08 +0000 (22:27 +0100)] 
Upgrade plugins to allow building on JDK 17.

- spotbugs 3.1.8 to 4.4.2
- jacoco to 0.8.7
- japicmp to 0.15.3

7 months agoCorrect first sentence of class javadoc
Alex Herbert [Wed, 20 Oct 2021 21:14:24 +0000 (22:14 +0100)] 
Correct first sentence of class javadoc

7 months agoAlign multi-line mathjax equations
Alex Herbert [Wed, 20 Oct 2021 21:01:35 +0000 (22:01 +0100)] 
Align multi-line mathjax equations

7 months agoNUMBERS-171: InverseErf to support the full range of [0, 2] 107/head
Alex Herbert [Thu, 14 Oct 2021 07:21:15 +0000 (08:21 +0100)] 
NUMBERS-171: InverseErf to support the full range of [0, 2]

Ported the Boost C++ function boost::math::erfc_inv. This supports
evaluation from double min value, superceding the support from 2^-53 in
the previous implementation.

Added a JMH benchmark for the Boost implementation verses the previous
version.

Documented special case return values for the inverse error functions
public API.

7 months agoUpdate PMD rules to correct syntax
aherbert [Fri, 15 Oct 2021 13:24:44 +0000 (14:24 +0100)] 
Update PMD rules to correct syntax

Previous syntax was ignored. Changed:

ClassOrInterfaceType -> ClassOrInterfaceDeclaration
@Image -> @SimpleName

Added addition exclusion for Fraction to mirror BigFraction exclusions.

Added RegularizedBeta exclusion to mirror the exclusions used for the
other gamma package classes.

7 months agoRun checkstyle in the validate phase
Alex Herbert [Thu, 14 Oct 2021 07:19:40 +0000 (08:19 +0100)] 
Run checkstyle in the validate phase

7 months agoNUMBERS-170: RegularizedBeta to handle edge cases
Alex Herbert [Sun, 10 Oct 2021 15:44:28 +0000 (16:44 +0100)] 
NUMBERS-170: RegularizedBeta to handle edge cases

7 months agoDo not perform minimal site checkout in pre-site phase
aherbert [Fri, 8 Oct 2021 13:51:36 +0000 (14:51 +0100)] 
Do not perform minimal site checkout in pre-site phase

This profile must now be explicitly activated.

7 months agoCorrect argument order for BrentSolver
Alex Herbert [Sun, 3 Oct 2021 15:27:39 +0000 (16:27 +0100)] 
Correct argument order for BrentSolver

7 months agoNUMBERS-168: Identify brackets with small objective values
Alex Herbert [Sat, 2 Oct 2021 23:38:45 +0000 (00:38 +0100)] 
NUMBERS-168: Identify brackets with small objective values

7 months agoUpdate SolverException to use String.format
Alex Herbert [Sat, 2 Oct 2021 23:13:24 +0000 (00:13 +0100)] 
Update SolverException to use String.format

MessageFormat cannot show Double.MIN_VALUE or Double.MIN_NORMAL. These
are represented as 0. Changing to String.format fixes this.

This was discovered from convergence errors involving sub-normal numbers
that have no useful information in the exception message (as the numbers
are zero).

7 months agoConsistent comment in private constructor
aherbert [Fri, 1 Oct 2021 16:35:10 +0000 (17:35 +0100)] 
Consistent comment in private constructor

All classes in the package no use 'intentionally empty'

7 months agoRemove unnecessary parentheses
aherbert [Fri, 1 Oct 2021 15:59:13 +0000 (16:59 +0100)] 
Remove unnecessary parentheses

7 months agoFix empty block comment typo
aherbert [Fri, 1 Oct 2021 15:56:32 +0000 (16:56 +0100)] 
Fix empty block comment typo

7 months agoUpdate to work for all target folders (Eclipse).
Gary Gregory [Tue, 28 Sep 2021 15:31:24 +0000 (11:31 -0400)] 
Update to work for all target folders (Eclipse).

7 months agoCorrect format string for FractionException
aherbert [Mon, 27 Sep 2021 13:18:46 +0000 (14:18 +0100)] 
Correct format string for FractionException

{0} is not applicable to String.format. It must use %conversion entries,
in this case %s.

Replace two exception messages for infinite or Nan with a single message
that formats the non-finite value in the message.

Replace 'maximal count' with 'maximum iterations'.

8 months agoCorrect typo
aherbert [Tue, 21 Sep 2021 16:04:31 +0000 (17:04 +0100)] 
Correct typo

8 months agoUpdate grammar for conscious language checker
Alex Herbert [Sun, 29 Aug 2021 18:07:42 +0000 (19:07 +0100)] 
Update grammar for conscious language checker

9 months agoAdd japicmp check for binary compatibility
Alex Herbert [Thu, 19 Aug 2021 00:14:17 +0000 (01:14 +0100)] 
Add japicmp check for binary compatibility

Added for all modules except complex-streams (which is not yet
released).

9 months agoUpdate distribution source archive specification
Alex Herbert [Wed, 18 Aug 2021 23:50:02 +0000 (00:50 +0100)] 
Update distribution source archive specification

Copy from commons-rng multi-module project

9 months agoRemove checksum from installed artifacts
Alex Herbert [Wed, 18 Aug 2021 23:48:54 +0000 (00:48 +0100)] 
Remove checksum from installed artifacts

This creates md5 and sha1 checksums for the dist-archive pom in the
local maven repository. It is not required.

9 months agoUpdate plugin order in pom
Alex Herbert [Wed, 18 Aug 2021 23:48:12 +0000 (00:48 +0100)] 
Update plugin order in pom

checkstyle
spotbugs
pmd

9 months agoRemove plugin checks from default goal
Alex Herbert [Wed, 18 Aug 2021 23:47:22 +0000 (00:47 +0100)] 
Remove plugin checks from default goal

These plugins already run using executions:

apache-rat:check (validate)
checkstyle:check (verify)

Added to verify using executions:

pmd:check
spotbugs:check

9 months agoRemove duplicate ConstantName module
Alex Herbert [Mon, 16 Aug 2021 08:56:16 +0000 (09:56 +0100)] 
Remove duplicate ConstantName module

9 months agoIgnore site-content.README 104/head
Alex Herbert [Fri, 13 Aug 2021 13:21:22 +0000 (14:21 +0100)] 
Ignore site-content.README

9 months agoAdd missing site checkout property to parent
Alex Herbert [Fri, 13 Aug 2021 13:14:06 +0000 (14:14 +0100)] 
Add missing site checkout property to parent

9 months agoClean site-content.README file
Alex Herbert [Fri, 13 Aug 2021 13:04:33 +0000 (14:04 +0100)] 
Clean site-content.README file

9 months agoAvoid existing site checkout in all child modules
Alex Herbert [Fri, 13 Aug 2021 08:17:37 +0000 (09:17 +0100)] 
Avoid existing site checkout in all child modules

9 months agoMerge pull request #103 from arturobernalg/feature/simplifyOperation
Alex Herbert [Thu, 12 Aug 2021 08:33:16 +0000 (09:33 +0100)] 
Merge pull request #103 from arturobernalg/feature/simplifyOperation

Simplify boolean expressions with a simpler equivalent.

9 months agoSimplify boolean expressions with an simpler and equivalent. 103/head
Arturo Bernal [Sat, 7 Aug 2021 08:46:10 +0000 (10:46 +0200)] 
Simplify boolean expressions with an simpler and equivalent.

9 months agoTrack changes
Alex Herbert [Sat, 7 Aug 2021 12:31:26 +0000 (13:31 +0100)] 
Track changes

9 months agoAdd XML schema
Alex Herbert [Sat, 7 Aug 2021 12:30:26 +0000 (13:30 +0100)] 
Add XML schema

9 months agoMerge pull request #102 from arturobernalg/feature/javadoc
Alex Herbert [Sat, 7 Aug 2021 12:29:45 +0000 (13:29 +0100)] 
Merge pull request #102 from arturobernalg/feature/javadoc

Fix wrong javadoc

9 months agoFix wrong javadoc 102/head
Arturo Bernal [Sat, 7 Aug 2021 08:40:48 +0000 (10:40 +0200)] 
Fix wrong javadoc

9 months agoRemove unnecessary nesting
Alex Herbert [Wed, 28 Jul 2021 20:54:27 +0000 (21:54 +0100)] 
Remove unnecessary nesting