[
https://issues.apache.org/jira/browse/NUMBERS-52?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18116984#comment-18116984
]
Alex Herbert commented on NUMBERS-52:
-------------------------------------
For reference the public API is:
{code:java}
public final class org.apache.commons.numbers.combinatorics.Stirling$S2 {
public static org.apache.commons.numbers.combinatorics.Stirling$S2 of(int,
int);
public long get();
public java.util.stream.Stream<int[][]> stream();
public <T> java.util.stream.Stream<java.util.List<java.util.List<T>>>
stream(java.util.List<T>);
public <T> java.util.stream.Stream<java.util.List<java.util.List<T>>>
stream(T...);
public java.lang.Iterable<int[][]> partitionGenerator();
}{code}
Example:
{code:java}
Stirling.S2.of(4, 2).stream().forEach(p ->
System.out.println(Arrays.deepToString(p)));
{code}
{noformat}
[[0, 1, 2], [3]]
[[0, 1, 3], [2]]
[[0, 1], [2, 3]]
[[0, 2, 3], [1]]
[[0, 2], [1, 3]]
[[0, 3], [1, 2]]
[[0], [1, 2, 3]]
{noformat}
This sort of output example could be added to the javadoc of the S2 class to
make it clear what the result is when using the class.
The actual implementation is neat and the tests are complete.
h2. API Change?
The two methods to accept an array of elements T or a List<T> are tied to the
instance. So if you want the k partitions of an object list:
{code:java}
List<X> list = ...
Stirling.S2.of(list.size(), k).stream(list);
{code}
I think it makes it more readable if the method is static allowing:
{code:java}
List<X> list = ...
Stirling.S2.stream(list, k);
{code}
Behind the scenes it will still raise the same exceptions and create the same
iterator via an S2 instance but the user only has to pass the list once.
> Incomplete beta function I(x, a, b) is inaccurate for large values of a
> and/or b
> --------------------------------------------------------------------------------
>
> Key: NUMBERS-52
> URL: https://issues.apache.org/jira/browse/NUMBERS-52
> Project: Commons Numbers
> Issue Type: Bug
> Reporter: Sebastien Brisard
> Priority: Major
> Labels: gsoc2019, special-functions
>
> This was first reported in MATH-718. The result of the current implementation
> of the incomplete beta function I(x, a, b) is inaccurate when a and/or b are
> large-ish.
> I've skimmed through [slatec|http://www.netlib.org/slatec/fnlib/betai.f],
> GSL,
> [Boost|http://www.boost.org/doc/libs/1_38_0/libs/math/doc/sf_and_dist/html/math_toolkit/special/sf_beta/ibeta_function.html]
> as well as NR. At first sight, neither uses the same method to compute this
> function. I think [TOMS-708|http://www.netlib.org/toms/708] is probably the
> best option.
> _Issue moved from MATH project on January 27, 2018 (concerned implementation
> was moved to module {{commons-numbers-gamma}} of "Commons Numbers")._
--
This message was sent by Atlassian Jira
(v8.20.10#820010)