[jira] [Commented] (NUMBERS-133) Speed up Primes.nextPrime(int)

2019-08-09 Thread Gilles (JIRA)


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

Gilles commented on NUMBERS-133:


The other advantage of MathJaX/LaTeX (vs Unicode characters?) is that some 
(text-based) softwares (e.g. "git diff") do not show the glyphs and display 
rather "cryptic" sequences of characters.  Which makes it fairly annoying to 
review...

> Speed up Primes.nextPrime(int)
> --
>
> Key: NUMBERS-133
> URL: https://issues.apache.org/jira/browse/NUMBERS-133
> Project: Commons Numbers
>  Issue Type: Improvement
>  Components: primes
>Affects Versions: 1.0
>Reporter: Heinrich Bohne
>Priority: Minor
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> The method {{Primes.nextPrime(int)}} can use the same algorithm to skip 
> multiples of certain primes as {{SmallPrimes.boundedTrialDivision(int, int, 
> List)}} uses, instead of hard-coding the alternating increment of 
> the trial candidate into a loop.
> Also, if the argument of the method is smaller than or equal to the 512th 
> prime number, the method can just infer the next higher prime number directly 
> from the array {{SmallPrimes.PRIMES}} without performing any calculations.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)


[jira] [Commented] (NUMBERS-133) Speed up Primes.nextPrime(int)

2019-08-09 Thread Gilles (JIRA)


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

Gilles commented on NUMBERS-133:


The rule of thumb would to use MathJaX for any formula that would make it 
easier to read (rendered or not).
The bar is quite low since even exponents and indices read better in LaTeX:
{noformat}
N_i^k
{noformat}
vs
{noformat}
Ni^k
{noformat}

bq. documentation of private or package-private elements? \[...\] IDEs 
generally don't render the MathJax \[...\]

Even so, it's clearer IMO. :-)

When referring to code elements (e.g. variable names), I generally use the 
Javadoc "@code" tag:
{code}
/**
 * @throws IllegalArgumentException if {@code x <= 0}.
 */
{code}
and the LaTeX syntax for mostly everything else (math-related).

Perhaps we should also provide rendered Javadoc for internal development, where 
the private elements are shown (?).

> Speed up Primes.nextPrime(int)
> --
>
> Key: NUMBERS-133
> URL: https://issues.apache.org/jira/browse/NUMBERS-133
> Project: Commons Numbers
>  Issue Type: Improvement
>  Components: primes
>Affects Versions: 1.0
>Reporter: Heinrich Bohne
>Priority: Minor
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> The method {{Primes.nextPrime(int)}} can use the same algorithm to skip 
> multiples of certain primes as {{SmallPrimes.boundedTrialDivision(int, int, 
> List)}} uses, instead of hard-coding the alternating increment of 
> the trial candidate into a loop.
> Also, if the argument of the method is smaller than or equal to the 512th 
> prime number, the method can just infer the next higher prime number directly 
> from the array {{SmallPrimes.PRIMES}} without performing any calculations.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)


[jira] [Commented] (NUMBERS-133) Speed up Primes.nextPrime(int)

2019-08-08 Thread Heinrich Bohne (JIRA)


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

Heinrich Bohne commented on NUMBERS-133:


I suppose you mean the modular congruence operators ≡ and ≢? Yes, sure. So 
should MathJax also be used for documentation of {{private}} or package-private 
elements? Because if that's the case, I'll need to update the documentation in 
[PR #66|https://github.com/apache/commons-numbers/pull/66], where I used html 
tags instead of MathJax. The reason I didn't use MathJax in {{private}} or 
package-private documentation is that, as far as I understand, IDEs generally 
don't render the MathJax, so the documentation is unlikely to be read by anyone 
in a format where the MathJax will be correctly displayed. But I can convert 
the documentation to MathJax, no problem.

> Speed up Primes.nextPrime(int)
> --
>
> Key: NUMBERS-133
> URL: https://issues.apache.org/jira/browse/NUMBERS-133
> Project: Commons Numbers
>  Issue Type: Improvement
>  Components: primes
>Affects Versions: 1.0
>Reporter: Heinrich Bohne
>Priority: Minor
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> The method {{Primes.nextPrime(int)}} can use the same algorithm to skip 
> multiples of certain primes as {{SmallPrimes.boundedTrialDivision(int, int, 
> List)}} uses, instead of hard-coding the alternating increment of 
> the trial candidate into a loop.
> Also, if the argument of the method is smaller than or equal to the 512th 
> prime number, the method can just infer the next higher prime number directly 
> from the array {{SmallPrimes.PRIMES}} without performing any calculations.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)


[jira] [Commented] (NUMBERS-133) Speed up Primes.nextPrime(int)

2019-08-08 Thread Gilles (JIRA)


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

Gilles commented on NUMBERS-133:


Could please replace special characters (in the Javadoc) by MathJax?  Thanks.

> Speed up Primes.nextPrime(int)
> --
>
> Key: NUMBERS-133
> URL: https://issues.apache.org/jira/browse/NUMBERS-133
> Project: Commons Numbers
>  Issue Type: Improvement
>  Components: primes
>Affects Versions: 1.0
>Reporter: Heinrich Bohne
>Priority: Minor
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> The method {{Primes.nextPrime(int)}} can use the same algorithm to skip 
> multiples of certain primes as {{SmallPrimes.boundedTrialDivision(int, int, 
> List)}} uses, instead of hard-coding the alternating increment of 
> the trial candidate into a loop.
> Also, if the argument of the method is smaller than or equal to the 512th 
> prime number, the method can just infer the next higher prime number directly 
> from the array {{SmallPrimes.PRIMES}} without performing any calculations.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)