[jira] [Commented] (MATH-1293) Tabulating the logarithmic factorial

2015-12-21 Thread Aleksei Dievskii (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15066396#comment-15066396
 ] 

Aleksei Dievskii commented on MATH-1293:


Thank you, Gilles! Everything looks good.

> Tabulating the logarithmic factorial
> 
>
> Key: MATH-1293
> URL: https://issues.apache.org/jira/browse/MATH-1293
> Project: Commons Math
>  Issue Type: Improvement
>Affects Versions: 3.5
>Reporter: Aleksei Dievskii
>Priority: Minor
>  Labels: feature, patch
> Attachments: factlog.patch, factlog_ondemand.patch
>
>
> Presently, CombinatoricsUtils#factorialLog is calculated via a tabulated 
> value for the first 21 entries, and for the rest it employs linear-complexity 
> direct summing. For the factorial-heavy computations this can be rather 
> painful. I propose a patch which allocates additional 16KB of tabulated 
> log-factorial values, allowing very fast (constant complexity) computation 
> for arguments up to 17000, and delegating to the log-gamma for the rest. 
> Benchmarks show a speed-up of up to 200x.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (MATH-1293) Tabulating the logarithmic factorial

2015-11-20 Thread Aleksei Dievskii (JIRA)

 [ 
https://issues.apache.org/jira/browse/MATH-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aleksei Dievskii updated MATH-1293:
---
Attachment: factlog_ondemand.patch

> Tabulating the logarithmic factorial
> 
>
> Key: MATH-1293
> URL: https://issues.apache.org/jira/browse/MATH-1293
> Project: Commons Math
>  Issue Type: Improvement
>Affects Versions: 3.5
>Reporter: Aleksei Dievskii
>Priority: Minor
>  Labels: feature, patch
> Attachments: factlog.patch, factlog_ondemand.patch
>
>
> Presently, CombinatoricsUtils#factorialLog is calculated via a tabulated 
> value for the first 21 entries, and for the rest it employs linear-complexity 
> direct summing. For the factorial-heavy computations this can be rather 
> painful. I propose a patch which allocates additional 16KB of tabulated 
> log-factorial values, allowing very fast (constant complexity) computation 
> for arguments up to 17000, and delegating to the log-gamma for the rest. 
> Benchmarks show a speed-up of up to 200x.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (MATH-1293) Tabulating the logarithmic factorial

2015-11-20 Thread Aleksei Dievskii (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15018202#comment-15018202
 ] 

Aleksei Dievskii commented on MATH-1293:


While the jury is still out, I made another variant of the patch, conforming to 
Gilles' suggestion. I attach it to the issue under the name 
"factlog_ondemand.patch".

> Tabulating the logarithmic factorial
> 
>
> Key: MATH-1293
> URL: https://issues.apache.org/jira/browse/MATH-1293
> Project: Commons Math
>  Issue Type: Improvement
>Affects Versions: 3.5
>Reporter: Aleksei Dievskii
>Priority: Minor
>  Labels: feature, patch
> Attachments: factlog.patch, factlog_ondemand.patch
>
>
> Presently, CombinatoricsUtils#factorialLog is calculated via a tabulated 
> value for the first 21 entries, and for the rest it employs linear-complexity 
> direct summing. For the factorial-heavy computations this can be rather 
> painful. I propose a patch which allocates additional 16KB of tabulated 
> log-factorial values, allowing very fast (constant complexity) computation 
> for arguments up to 17000, and delegating to the log-gamma for the rest. 
> Benchmarks show a speed-up of up to 200x.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Comment Edited] (MATH-1293) Tabulating the logarithmic factorial

2015-11-19 Thread Aleksei Dievskii (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15013226#comment-15013226
 ] 

Aleksei Dievskii edited comment on MATH-1293 at 11/19/15 10:18 AM:
---

At that moment, no. I was operating under assumption that I can send messages 
to the list without being subscribed. Presently, I have successfully subscribed 
and re-sent my message. However, it has yet to appear in the archive or be 
otherwise acknowledged.


was (Author: dievsky):
At that moment, no. I was operating under assumption that I can send messages 
to the list without being subscribed. Presently, I have successfully subscribed 
and re-sent my message.

> Tabulating the logarithmic factorial
> 
>
> Key: MATH-1293
> URL: https://issues.apache.org/jira/browse/MATH-1293
> Project: Commons Math
>  Issue Type: Improvement
>Affects Versions: 3.5
>Reporter: Aleksei Dievskii
>Priority: Minor
>  Labels: feature, patch
> Attachments: factlog.patch
>
>
> Presently, CombinatoricsUtils#factorialLog is calculated via a tabulated 
> value for the first 21 entries, and for the rest it employs linear-complexity 
> direct summing. For the factorial-heavy computations this can be rather 
> painful. I propose a patch which allocates additional 16KB of tabulated 
> log-factorial values, allowing very fast (constant complexity) computation 
> for arguments up to 17000, and delegating to the log-gamma for the rest. 
> Benchmarks show a speed-up of up to 200x.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (MATH-1293) Tabulating the logarithmic factorial

2015-11-19 Thread Aleksei Dievskii (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15013226#comment-15013226
 ] 

Aleksei Dievskii commented on MATH-1293:


At that moment, no. I was operating under assumption that I can send messages 
to the list without being subscribed. Presently, I have successfully subscribed 
and re-sent my message.

> Tabulating the logarithmic factorial
> 
>
> Key: MATH-1293
> URL: https://issues.apache.org/jira/browse/MATH-1293
> Project: Commons Math
>  Issue Type: Improvement
>Affects Versions: 3.5
>Reporter: Aleksei Dievskii
>Priority: Minor
>  Labels: feature, patch
> Attachments: factlog.patch
>
>
> Presently, CombinatoricsUtils#factorialLog is calculated via a tabulated 
> value for the first 21 entries, and for the rest it employs linear-complexity 
> direct summing. For the factorial-heavy computations this can be rather 
> painful. I propose a patch which allocates additional 16KB of tabulated 
> log-factorial values, allowing very fast (constant complexity) computation 
> for arguments up to 17000, and delegating to the log-gamma for the rest. 
> Benchmarks show a speed-up of up to 200x.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (MATH-1293) Tabulating the logarithmic factorial

2015-11-18 Thread Aleksei Dievskii (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15011295#comment-15011295
 ] 

Aleksei Dievskii commented on MATH-1293:


Thank you for your advice! However, I'm not exactly sure how to do this. I've 
sent an email to d...@commons.apache.org, but it hasn't shown up in the archive 
at https://mail-archives.apache.org/mod_mbox/commons-dev/201511.mbox/browser . 
Is it the wrong way to reach the mailing list?

> Tabulating the logarithmic factorial
> 
>
> Key: MATH-1293
> URL: https://issues.apache.org/jira/browse/MATH-1293
> Project: Commons Math
>  Issue Type: Improvement
>Affects Versions: 3.5
>Reporter: Aleksei Dievskii
>Priority: Minor
>  Labels: feature, patch
> Attachments: factlog.patch
>
>
> Presently, CombinatoricsUtils#factorialLog is calculated via a tabulated 
> value for the first 21 entries, and for the rest it employs linear-complexity 
> direct summing. For the factorial-heavy computations this can be rather 
> painful. I propose a patch which allocates additional 16KB of tabulated 
> log-factorial values, allowing very fast (constant complexity) computation 
> for arguments up to 17000, and delegating to the log-gamma for the rest. 
> Benchmarks show a speed-up of up to 200x.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (MATH-1293) Tabulating the logarithmic factorial

2015-11-18 Thread Aleksei Dievskii (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15011000#comment-15011000
 ] 

Aleksei Dievskii commented on MATH-1293:


OK, I attached the new patch.

> Tabulating the logarithmic factorial
> 
>
> Key: MATH-1293
> URL: https://issues.apache.org/jira/browse/MATH-1293
> Project: Commons Math
>  Issue Type: Improvement
>Affects Versions: 3.5
>Reporter: Aleksei Dievskii
>Priority: Minor
>  Labels: feature, patch
> Attachments: factlog.patch
>
>
> Presently, CombinatoricsUtils#factorialLog is calculated via a tabulated 
> value for the first 21 entries, and for the rest it employs linear-complexity 
> direct summing. For the factorial-heavy computations this can be rather 
> painful. I propose a patch which allocates additional 16KB of tabulated 
> log-factorial values, allowing very fast (constant complexity) computation 
> for arguments up to 17000, and delegating to the log-gamma for the rest. 
> Benchmarks show a speed-up of up to 200x.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (MATH-1293) Tabulating the logarithmic factorial

2015-11-18 Thread Aleksei Dievskii (JIRA)

 [ 
https://issues.apache.org/jira/browse/MATH-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aleksei Dievskii updated MATH-1293:
---
Attachment: factlog.patch

> Tabulating the logarithmic factorial
> 
>
> Key: MATH-1293
> URL: https://issues.apache.org/jira/browse/MATH-1293
> Project: Commons Math
>  Issue Type: Improvement
>Affects Versions: 3.5
>Reporter: Aleksei Dievskii
>Priority: Minor
>  Labels: feature, patch
> Attachments: factlog.patch
>
>
> Presently, CombinatoricsUtils#factorialLog is calculated via a tabulated 
> value for the first 21 entries, and for the rest it employs linear-complexity 
> direct summing. For the factorial-heavy computations this can be rather 
> painful. I propose a patch which allocates additional 16KB of tabulated 
> log-factorial values, allowing very fast (constant complexity) computation 
> for arguments up to 17000, and delegating to the log-gamma for the rest. 
> Benchmarks show a speed-up of up to 200x.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (MATH-1293) Tabulating the logarithmic factorial

2015-11-18 Thread Aleksei Dievskii (JIRA)

 [ 
https://issues.apache.org/jira/browse/MATH-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aleksei Dievskii updated MATH-1293:
---
Attachment: (was: factlog.patch)

> Tabulating the logarithmic factorial
> 
>
> Key: MATH-1293
> URL: https://issues.apache.org/jira/browse/MATH-1293
> Project: Commons Math
>  Issue Type: Improvement
>Affects Versions: 3.5
>Reporter: Aleksei Dievskii
>Priority: Minor
>  Labels: feature, patch
>
> Presently, CombinatoricsUtils#factorialLog is calculated via a tabulated 
> value for the first 21 entries, and for the rest it employs linear-complexity 
> direct summing. For the factorial-heavy computations this can be rather 
> painful. I propose a patch which allocates additional 16KB of tabulated 
> log-factorial values, allowing very fast (constant complexity) computation 
> for arguments up to 17000, and delegating to the log-gamma for the rest. 
> Benchmarks show a speed-up of up to 200x.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (MATH-1293) Tabulating the logarithmic factorial

2015-11-18 Thread Aleksei Dievskii (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15010886#comment-15010886
 ] 

Aleksei Dievskii commented on MATH-1293:


This sounds simple! I will then attempt to make it so and attach a new patch.

> Tabulating the logarithmic factorial
> 
>
> Key: MATH-1293
> URL: https://issues.apache.org/jira/browse/MATH-1293
> Project: Commons Math
>  Issue Type: Improvement
>Affects Versions: 3.5
>Reporter: Aleksei Dievskii
>Priority: Minor
>  Labels: feature, patch
> Attachments: factlog.patch
>
>
> Presently, CombinatoricsUtils#factorialLog is calculated via a tabulated 
> value for the first 21 entries, and for the rest it employs linear-complexity 
> direct summing. For the factorial-heavy computations this can be rather 
> painful. I propose a patch which allocates additional 16KB of tabulated 
> log-factorial values, allowing very fast (constant complexity) computation 
> for arguments up to 17000, and delegating to the log-gamma for the rest. 
> Benchmarks show a speed-up of up to 200x.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (MATH-1293) Tabulating the logarithmic factorial

2015-11-18 Thread Aleksei Dievskii (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15010789#comment-15010789
 ] 

Aleksei Dievskii commented on MATH-1293:


Gilles, thanks for your response. However, I don't quite understand what do you 
mean. Should I create a package-local class which would contain only the 
constants and the method to retrieve them (and extensive documentation, of 
course), and then make factorialLog delegate to that method?

> Tabulating the logarithmic factorial
> 
>
> Key: MATH-1293
> URL: https://issues.apache.org/jira/browse/MATH-1293
> Project: Commons Math
>  Issue Type: Improvement
>Affects Versions: 3.5
>Reporter: Aleksei Dievskii
>Priority: Minor
>  Labels: feature, patch
> Attachments: factlog.patch
>
>
> Presently, CombinatoricsUtils#factorialLog is calculated via a tabulated 
> value for the first 21 entries, and for the rest it employs linear-complexity 
> direct summing. For the factorial-heavy computations this can be rather 
> painful. I propose a patch which allocates additional 16KB of tabulated 
> log-factorial values, allowing very fast (constant complexity) computation 
> for arguments up to 17000, and delegating to the log-gamma for the rest. 
> Benchmarks show a speed-up of up to 200x.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (MATH-1293) Tabulating the logarithmic factorial

2015-11-18 Thread Aleksei Dievskii (JIRA)

 [ 
https://issues.apache.org/jira/browse/MATH-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aleksei Dievskii updated MATH-1293:
---
Attachment: factlog.patch

The logarithmic factorial patch.

> Tabulating the logarithmic factorial
> 
>
> Key: MATH-1293
> URL: https://issues.apache.org/jira/browse/MATH-1293
> Project: Commons Math
>  Issue Type: Improvement
>Affects Versions: 3.5
>Reporter: Aleksei Dievskii
>Priority: Minor
>  Labels: feature, patch
> Attachments: factlog.patch
>
>
> Presently, CombinatoricsUtils#factorialLog is calculated via a tabulated 
> value for the first 21 entries, and for the rest it employs linear-complexity 
> direct summing. For the factorial-heavy computations this can be rather 
> painful. I propose a patch which allocates additional 16KB of tabulated 
> log-factorial values, allowing very fast (constant complexity) computation 
> for arguments up to 17000, and delegating to the log-gamma for the rest. 
> Benchmarks show a speed-up of up to 200x.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Created] (MATH-1293) Tabulating the logarithmic factorial

2015-11-18 Thread Aleksei Dievskii (JIRA)
Aleksei Dievskii created MATH-1293:
--

 Summary: Tabulating the logarithmic factorial
 Key: MATH-1293
 URL: https://issues.apache.org/jira/browse/MATH-1293
 Project: Commons Math
  Issue Type: Improvement
Affects Versions: 3.5
Reporter: Aleksei Dievskii
Priority: Minor


Presently, CombinatoricsUtils#factorialLog is calculated via a tabulated value 
for the first 21 entries, and for the rest it employs linear-complexity direct 
summing. For the factorial-heavy computations this can be rather painful. I 
propose a patch which allocates additional 16KB of tabulated log-factorial 
values, allowing very fast (constant complexity) computation for arguments up 
to 17000, and delegating to the log-gamma for the rest. Benchmarks show a 
speed-up of up to 200x.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Created] (MATH-1241) Digamma calculation produces SOE on NaN argument

2015-06-24 Thread Aleksei Dievskii (JIRA)
Aleksei Dievskii created MATH-1241:
--

 Summary: Digamma calculation produces SOE on NaN argument
 Key: MATH-1241
 URL: https://issues.apache.org/jira/browse/MATH-1241
 Project: Commons Math
  Issue Type: Bug
Affects Versions: 3.5
Reporter: Aleksei Dievskii
Priority: Minor


Digamma doesn't work particularly well with NaNs.

How to reproduce: call Gamma.digamma(Double.NaN)

Expected outcome: returns NaN or throws a meaningful exception

Real outcome: crashes with StackOverflowException, as digamma enters infinite 
recursion.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (MATH-1136) BinomialDistribution deals with degenerate cases incorrectly

2014-07-11 Thread Aleksei Dievskii (JIRA)

 [ 
https://issues.apache.org/jira/browse/MATH-1136?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aleksei Dievskii updated MATH-1136:
---

Description: 
The following calculation returns false results:

{{new BinomialDistribution(0, 0.01).logProbability(0)}}

It evaluates to Double.NaN when it should be 0 (cf., for example, "dbinom(0, 0, 
0.01, log=T)" in R).

I attach a patch dealing with the problem. The patch also adds a test for this 
bug.

  was:
The following calculation returns false results:

{{new BinomialDistribution(0, 0.01).logProbability(0)}}

It evaluates to Double.NaN when it should be 0 (cf., for example, "dbinom(0, 0, 
0.01, log=T)" in R).

I attach a patch dealing with the problem.


> BinomialDistribution deals with degenerate cases incorrectly
> 
>
> Key: MATH-1136
> URL: https://issues.apache.org/jira/browse/MATH-1136
> Project: Commons Math
>  Issue Type: Bug
>Affects Versions: 3.3
>Reporter: Aleksei Dievskii
>Priority: Minor
>  Labels: bug, patch
> Attachments: BINOMIAL_DEGENERATE.patch
>
>
> The following calculation returns false results:
> {{new BinomialDistribution(0, 0.01).logProbability(0)}}
> It evaluates to Double.NaN when it should be 0 (cf., for example, "dbinom(0, 
> 0, 0.01, log=T)" in R).
> I attach a patch dealing with the problem. The patch also adds a test for 
> this bug.



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Updated] (MATH-1136) BinomialDistribution deals with degenerate cases incorrectly

2014-07-11 Thread Aleksei Dievskii (JIRA)

 [ 
https://issues.apache.org/jira/browse/MATH-1136?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aleksei Dievskii updated MATH-1136:
---

Description: 
The following calculation returns false results:

{{new BinomialDistribution(0, 0.01).logProbability(0)}}

It evaluates to Double.NaN when it should be 0 (cf., for example, "dbinom(0, 0, 
0.01, log=T)" in R).

I attach a patch dealing with the problem.

  was:
The following calculation returns false results:

{{
new BinomialDistribution(0, 0.01).logProbability(0)
}}

It evaluates to Double.NaN when it should be 0 (cf., for example, "dbinom(0, 0, 
0.01, log=T)" in R).

I attach a patch dealing with the problem.


> BinomialDistribution deals with degenerate cases incorrectly
> 
>
> Key: MATH-1136
> URL: https://issues.apache.org/jira/browse/MATH-1136
> Project: Commons Math
>  Issue Type: Bug
>Affects Versions: 3.3
>Reporter: Aleksei Dievskii
>Priority: Minor
>  Labels: bug, patch
> Attachments: BINOMIAL_DEGENERATE.patch
>
>
> The following calculation returns false results:
> {{new BinomialDistribution(0, 0.01).logProbability(0)}}
> It evaluates to Double.NaN when it should be 0 (cf., for example, "dbinom(0, 
> 0, 0.01, log=T)" in R).
> I attach a patch dealing with the problem.



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Updated] (MATH-1136) BinomialDistribution deals with degenerate cases incorrectly

2014-07-11 Thread Aleksei Dievskii (JIRA)

 [ 
https://issues.apache.org/jira/browse/MATH-1136?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aleksei Dievskii updated MATH-1136:
---

Description: 
The following calculation returns false results:

{{
new BinomialDistribution(0, 0.01).logProbability(0)
}}

It evaluates to Double.NaN when it should be 0 (cf., for example, "dbinom(0, 0, 
0.01, log=T)" in R).

I attach a patch dealing with the problem.

  was:
The following calculation returns false results:

{{
new BinomialDistribution(0, 0.01).logProbability(0)
}}

It evaluates to Double.NaN when it should be 0 (cf., for example, "dbinom(0, 0, 
0.01, log=T)" in R).

I will attach a patch dealing with the problem shortly.


> BinomialDistribution deals with degenerate cases incorrectly
> 
>
> Key: MATH-1136
> URL: https://issues.apache.org/jira/browse/MATH-1136
> Project: Commons Math
>  Issue Type: Bug
>Affects Versions: 3.3
>Reporter: Aleksei Dievskii
>Priority: Minor
>  Labels: bug, patch
> Attachments: BINOMIAL_DEGENERATE.patch
>
>
> The following calculation returns false results:
> {{
> new BinomialDistribution(0, 0.01).logProbability(0)
> }}
> It evaluates to Double.NaN when it should be 0 (cf., for example, "dbinom(0, 
> 0, 0.01, log=T)" in R).
> I attach a patch dealing with the problem.



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Created] (MATH-1136) BinomialDistribution deals with degenerate cases incorrectly

2014-07-11 Thread Aleksei Dievskii (JIRA)
Aleksei Dievskii created MATH-1136:
--

 Summary: BinomialDistribution deals with degenerate cases 
incorrectly
 Key: MATH-1136
 URL: https://issues.apache.org/jira/browse/MATH-1136
 Project: Commons Math
  Issue Type: Bug
Affects Versions: 3.3
Reporter: Aleksei Dievskii
Priority: Minor
 Attachments: BINOMIAL_DEGENERATE.patch

The following calculation returns false results:

{{
new BinomialDistribution(0, 0.01).logProbability(0)
}}

It evaluates to Double.NaN when it should be 0 (cf., for example, "dbinom(0, 0, 
0.01, log=T)" in R).

I will attach a patch dealing with the problem shortly.



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Updated] (MATH-1136) BinomialDistribution deals with degenerate cases incorrectly

2014-07-11 Thread Aleksei Dievskii (JIRA)

 [ 
https://issues.apache.org/jira/browse/MATH-1136?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aleksei Dievskii updated MATH-1136:
---

Attachment: BINOMIAL_DEGENERATE.patch

> BinomialDistribution deals with degenerate cases incorrectly
> 
>
> Key: MATH-1136
> URL: https://issues.apache.org/jira/browse/MATH-1136
> Project: Commons Math
>  Issue Type: Bug
>Affects Versions: 3.3
>Reporter: Aleksei Dievskii
>Priority: Minor
>  Labels: bug, patch
> Attachments: BINOMIAL_DEGENERATE.patch
>
>
> The following calculation returns false results:
> {{
> new BinomialDistribution(0, 0.01).logProbability(0)
> }}
> It evaluates to Double.NaN when it should be 0 (cf., for example, "dbinom(0, 
> 0, 0.01, log=T)" in R).
> I will attach a patch dealing with the problem shortly.



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (MATH-1039) Logarithmic probability and density calculations for the distributions

2013-10-21 Thread Aleksei Dievskii (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-1039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13800519#comment-13800519
 ] 

Aleksei Dievskii commented on MATH-1039:


You're welcome!

> Logarithmic probability and density calculations for the distributions
> --
>
> Key: MATH-1039
> URL: https://issues.apache.org/jira/browse/MATH-1039
> Project: Commons Math
>  Issue Type: New Feature
>Reporter: Aleksei Dievskii
>Assignee: Phil Steitz
>Priority: Minor
>  Labels: features, patch
> Fix For: 4.0
>
> Attachments: LOGDENSITY.patch
>
>
> A person working with fairly small probabilities and densities often employs 
> their logarithms to increase precision and decrease the chance of an 
> underflow. However, just taking a log of the probability() or density() 
> return value doesn't necessarily solve the problem, as these methods 
> themselves could have lost precision or underflowed. This patch introduces 
> new logProbability() and logDensity() methods overriden for many relevant 
> distribution. The patch also introduces tests of these new methods.



--
This message was sent by Atlassian JIRA
(v6.1#6144)


[jira] [Commented] (MATH-1039) Logarithmic probability and density calculations for the distributions

2013-10-16 Thread Aleksei Dievskii (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-1039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13796558#comment-13796558
 ] 

Aleksei Dievskii commented on MATH-1039:


2.14.1, though I don't think that they changed these functions in the next 
release.

> Logarithmic probability and density calculations for the distributions
> --
>
> Key: MATH-1039
> URL: https://issues.apache.org/jira/browse/MATH-1039
> Project: Commons Math
>  Issue Type: New Feature
>Reporter: Aleksei Dievskii
>Priority: Minor
>  Labels: features, patch
> Attachments: LOGDENSITY.patch
>
>
> A person working with fairly small probabilities and densities often employs 
> their logarithms to increase precision and decrease the chance of an 
> underflow. However, just taking a log of the probability() or density() 
> return value doesn't necessarily solve the problem, as these methods 
> themselves could have lost precision or underflowed. This patch introduces 
> new logProbability() and logDensity() methods overriden for many relevant 
> distribution. The patch also introduces tests of these new methods.



--
This message was sent by Atlassian JIRA
(v6.1#6144)


[jira] [Updated] (MATH-1039) Logarithmic probability and density calculations for the distributions

2013-10-15 Thread Aleksei Dievskii (JIRA)

 [ 
https://issues.apache.org/jira/browse/MATH-1039?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aleksei Dievskii updated MATH-1039:
---

Description: A person working with fairly small probabilities and densities 
often employs their logarithms to increase precision and decrease the chance of 
an underflow. However, just taking a log of the probability() or density() 
return value doesn't necessarily solve the problem, as these methods themselves 
could have lost precision or underflowed. This patch introduces new 
logProbability() and logDensity() methods overriden for many relevant 
distribution. The patch also introduces tests of these new methods.  (was: A 
person working with fairly small probabilities and densities often employs 
their logarithms to increase precision and decrease the chance of an underflow. 
However, just taking a log of the probability() or density() return value 
doesn't necessary solve the problem, as these methods themselves could have 
lost precision or underflowed. This patch introduces new logProbability() and 
logDensity() methods overriden for many relevant distribution. The patch also 
introduces tests of these new methods.)

> Logarithmic probability and density calculations for the distributions
> --
>
> Key: MATH-1039
> URL: https://issues.apache.org/jira/browse/MATH-1039
> Project: Commons Math
>  Issue Type: New Feature
>Reporter: Aleksei Dievskii
>Priority: Minor
>  Labels: features, patch
> Attachments: LOGDENSITY.patch
>
>
> A person working with fairly small probabilities and densities often employs 
> their logarithms to increase precision and decrease the chance of an 
> underflow. However, just taking a log of the probability() or density() 
> return value doesn't necessarily solve the problem, as these methods 
> themselves could have lost precision or underflowed. This patch introduces 
> new logProbability() and logDensity() methods overriden for many relevant 
> distribution. The patch also introduces tests of these new methods.



--
This message was sent by Atlassian JIRA
(v6.1#6144)


[jira] [Commented] (MATH-1039) Logarithmic probability and density calculations for the distributions

2013-10-15 Thread Aleksei Dievskii (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-1039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13794997#comment-13794997
 ] 

Aleksei Dievskii commented on MATH-1039:


1. I didn't know that interfaces couldn't be changed outside a major release. 
Of course, keeping the changes to abstract parents will cover the immediate 
needs.
2. The reference data come from R (so I just haven't changed the overall 
testing data disclaimer). I used the standard density functions (dpois, dnorm 
and so on) with log=TRUE argument.

> Logarithmic probability and density calculations for the distributions
> --
>
> Key: MATH-1039
> URL: https://issues.apache.org/jira/browse/MATH-1039
> Project: Commons Math
>  Issue Type: New Feature
>Reporter: Aleksei Dievskii
>Priority: Minor
>  Labels: features, patch
> Attachments: LOGDENSITY.patch
>
>
> A person working with fairly small probabilities and densities often employs 
> their logarithms to increase precision and decrease the chance of an 
> underflow. However, just taking a log of the probability() or density() 
> return value doesn't necessary solve the problem, as these methods themselves 
> could have lost precision or underflowed. This patch introduces new 
> logProbability() and logDensity() methods overriden for many relevant 
> distribution. The patch also introduces tests of these new methods.



--
This message was sent by Atlassian JIRA
(v6.1#6144)


[jira] [Commented] (MATH-1037) Distribution tests are mostly meaningless due to high tolerance

2013-10-14 Thread Aleksei Dievskii (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-1037?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13794023#comment-13794023
 ] 

Aleksei Dievskii commented on MATH-1037:


Glad to be of help!

> Distribution tests are mostly meaningless due to high tolerance
> ---
>
> Key: MATH-1037
> URL: https://issues.apache.org/jira/browse/MATH-1037
> Project: Commons Math
>  Issue Type: Bug
>Affects Versions: 3.2
>Reporter: Aleksei Dievskii
>Priority: Minor
> Fix For: 3.3
>
>
> The tolerance used for value comparison in 
> {{IntegerDistributionAbstractTest}} is {{1E-4}}. However, most values being 
> compared are much smaller, so they are considered equal even if they 
> otherwise differ by orders of magnitude. For example, a typo in 
> {{GeometricDistributionTest}} puts 29 in the test points instead of 19, while 
> the test probability value is correctly given for 19. The test passes, 
> disregarding the fact that {{2.437439e-05}} (test value for 19) and 
> {{1.473826e-07}} (actual value for 29) differ almost hundredfold.



--
This message was sent by Atlassian JIRA
(v6.1#6144)


[jira] [Updated] (MATH-1039) Logarithmic probability and density calculations for the distributions

2013-09-27 Thread Aleksei Dievskii (JIRA)

 [ 
https://issues.apache.org/jira/browse/MATH-1039?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aleksei Dievskii updated MATH-1039:
---

Attachment: LOGDENSITY.patch

The patch introducing logDensity() and logProbability().

> Logarithmic probability and density calculations for the distributions
> --
>
> Key: MATH-1039
> URL: https://issues.apache.org/jira/browse/MATH-1039
> Project: Commons Math
>  Issue Type: New Feature
>Reporter: Aleksei Dievskii
>Priority: Minor
>  Labels: features, patch
> Attachments: LOGDENSITY.patch
>
>
> A person working with fairly small probabilities and densities often employs 
> their logarithms to increase precision and decrease the chance of an 
> underflow. However, just taking a log of the probability() or density() 
> return value doesn't necessary solve the problem, as these methods themselves 
> could have lost precision or underflowed. This patch introduces new 
> logProbability() and logDensity() methods overriden for many relevant 
> distribution. The patch also introduces tests of these new methods.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Created] (MATH-1039) Logarithmic probability and density calculations for the distributions

2013-09-27 Thread Aleksei Dievskii (JIRA)
Aleksei Dievskii created MATH-1039:
--

 Summary: Logarithmic probability and density calculations for the 
distributions
 Key: MATH-1039
 URL: https://issues.apache.org/jira/browse/MATH-1039
 Project: Commons Math
  Issue Type: New Feature
Reporter: Aleksei Dievskii
Priority: Minor


A person working with fairly small probabilities and densities often employs 
their logarithms to increase precision and decrease the chance of an underflow. 
However, just taking a log of the probability() or density() return value 
doesn't necessary solve the problem, as these methods themselves could have 
lost precision or underflowed. This patch introduces new logProbability() and 
logDensity() methods overriden for many relevant distribution. The patch also 
introduces tests of these new methods.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Updated] (MATH-1037) Distribution tests are mostly meaningless due to high tolerance

2013-09-26 Thread Aleksei Dievskii (JIRA)

 [ 
https://issues.apache.org/jira/browse/MATH-1037?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aleksei Dievskii updated MATH-1037:
---

Summary: Distribution tests are mostly meaningless due to high tolerance  
(was: Distribution tests are mostly meaningful due to high tolerance)

> Distribution tests are mostly meaningless due to high tolerance
> ---
>
> Key: MATH-1037
> URL: https://issues.apache.org/jira/browse/MATH-1037
> Project: Commons Math
>  Issue Type: Bug
>Affects Versions: 3.2
>Reporter: Aleksei Dievskii
>Priority: Minor
>
> The tolerance used for value comparison in 
> {{IntegerDistributionAbstractTest}} is {{1E-4}}. However, most values being 
> compared are much smaller, so they are considered equal even if they 
> otherwise differ by orders of magnitude. For example, a typo in 
> {{GeometricDistributionTest}} puts 29 in the test points instead of 19, while 
> the test probability value is correctly given for 19. The test passes, 
> disregarding the fact that {{2.437439e-05}} (test value for 19) and 
> {{1.473826e-07}} (actual value for 29) differ almost hundredfold.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Created] (MATH-1037) Distribution tests are mostly meaningful due to high tolerance

2013-09-25 Thread Aleksei Dievskii (JIRA)
Aleksei Dievskii created MATH-1037:
--

 Summary: Distribution tests are mostly meaningful due to high 
tolerance
 Key: MATH-1037
 URL: https://issues.apache.org/jira/browse/MATH-1037
 Project: Commons Math
  Issue Type: Bug
Affects Versions: 3.2
Reporter: Aleksei Dievskii
Priority: Minor


The tolerance used for value comparison in {{IntegerDistributionAbstractTest}} 
is {{1E-4}}. However, most values being compared are much smaller, so they are 
considered equal even if they otherwise differ by orders of magnitude. For 
example, a typo in {{GeometricDistributionTest}} puts 29 in the test points 
instead of 19, while the test probability value is correctly given for 19. The 
test passes, disregarding the fact that {{2.437439e-05}} (test value for 19) 
and {{1.473826e-07}} (actual value for 29) differ almost hundredfold.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira