[
https://issues.apache.org/jira/browse/MATH-845?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13434283#comment-13434283
]
Sebastien Riou edited comment on MATH-845 at 8/15/12 5:08 AM:
--------------------------------------------------------------
Thanks for the review, I will apply the requested formatting next time. So I
guess I am not running checkstyle correctly, because I did not see any of those
errors in the report. I run it from command line "mvn checkstyle:checkstyle",
and I have modified my local copy of pom.xml with the following:
{noformat} <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
</configuration>
</plugin>
{noformat}
inserted in <build>. Is there something I am missing ?
About "assert", In the case of private or package private methods, is it also
required to turn them into runtime checks ? Is it acceptable to simply comment
them if the performance impact is significant ?
interface Primes<T extends Number> -> agreed
implementation/performance question: I expect implementation for long to be
significantly slower, as it is the case for gcd. int implementation uses long
for some internal values, so a long implementation will need to use BigInteger
at those places, that should slow down things... Also current int
implementation contain an array with all primes smaller or equal to the cubic
square of Integer.MAX_VALUE. Doing the same for Long.MAX_VALUE is going to
significantly increase the size of the array, I am not sure if this is
desirable -> in short some performance tricks applicable to int don't scale
well. In case of isPrime, the trick to get a provable result using Miller-Rabin
works well for int, but I have to search additional reference to get the magic
numbers to scale it to long, and even after that, maybe we will end up with
something slower than a true provable algorithm.
I am more inclined to share the same implementation for long and BigInteger.
was (Author: acapola):
Thanks for the review, I will apply the requested formatting next time. So
I guess I am not running checkstyle correctly, because I did not see any of
those errors in the report. I run it from command line "mvn
checkstyle:checkstyle", and I have modified my local copy of pom.xml with the
following:
{noformat} <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
</configuration>
</plugin>
{noformat}
inserted in <build>. Is there something I am missing ?
About "assert", In the case of private or package private methods, is it also
required to turn them into runtime checks ? Is it acceptable to simply comment
them if the performance impact is significant ?
interface Primes<T extends Number> -> agreed
implementation/performance question: I expect implementation for long to be
significantly slower, as it is the case for gcd. int implementation uses long
for some internal values, so a long implementation will need to use BigInteger
at those places, that should slow down things... Also current int
implementation contain an array with all primes smaller or equal to the cubic
square of Integer.MAX_VALUE. Doing the same for Long.MAX_VALUE is going to
significantly increase the size of the array, I am not sure if this is
desirable -> in short some performance tricks applicable to int don't scale
well.
I am more inclined to share the same implementation for long and BigInteger.
> Basic number theory features such as primality testing, factorization and
> prime number generation
> -------------------------------------------------------------------------------------------------
>
> Key: MATH-845
> URL: https://issues.apache.org/jira/browse/MATH-845
> Project: Commons Math
> Issue Type: New Feature
> Affects Versions: 3.1
> Environment: ubuntu/java6/intel-i5
> Reporter: Sebastien Riou
> Priority: Minor
> Labels: features
> Fix For: 3.1
>
> Attachments: primes-src.zip
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> A set of static methods to perform primality test, factorization and prime
> number generation. Currently it is limited to the int data type, extension to
> long/BigInteger will follow.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira