You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mahout.apache.org by "Emerson Murphy-HIll (JIRA)" <ji...@apache.org> on 2009/10/16 17:45:31 UTC

[jira] Created: (MAHOUT-187) RandomUtils>>isNotPrime throws IllegalArgumentException when argument is less than 2.

RandomUtils>>isNotPrime throws IllegalArgumentException when argument is less than 2.
-------------------------------------------------------------------------------------

                 Key: MAHOUT-187
                 URL: https://issues.apache.org/jira/browse/MAHOUT-187
             Project: Mahout
          Issue Type: Bug
    Affects Versions: 0.1
            Reporter: Emerson Murphy-HIll


I was using a FastMap, which happened to be empty, and rehash() was called.  Rehash eventually calls isNotPrime where n=1, which throws an illegal argument exception:

  public static boolean isNotPrime(int n) {
    if (n < 2) {
      throw new IllegalArgumentException();
    }

It seems to me anything less than two is not prime.  Thus, I suggest:

  public static boolean isNotPrime(int n) {
    if (n < 2) {
    	return true;
    }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (MAHOUT-187) RandomUtils>>isNotPrime throws IllegalArgumentException when argument is less than 2.

Posted by "Sean Owen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MAHOUT-187?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sean Owen resolved MAHOUT-187.
------------------------------

    Resolution: Fixed

> RandomUtils>>isNotPrime throws IllegalArgumentException when argument is less than 2.
> -------------------------------------------------------------------------------------
>
>                 Key: MAHOUT-187
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-187
>             Project: Mahout
>          Issue Type: Bug
>    Affects Versions: 0.1
>            Reporter: Emerson Murphy-HIll
>            Assignee: Sean Owen
>             Fix For: 0.2
>
>
> I was using a FastMap, which happened to be empty, and rehash() was called.  Rehash eventually calls isNotPrime where n=1, which throws an illegal argument exception:
>   public static boolean isNotPrime(int n) {
>     if (n < 2) {
>       throw new IllegalArgumentException();
>     }
> It seems to me anything less than two is not prime.  Thus, I suggest:
>   public static boolean isNotPrime(int n) {
>     if (n < 2) {
>     	return true;
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MAHOUT-187) RandomUtils>>isNotPrime throws IllegalArgumentException when argument is less than 2.

Posted by "Sean Owen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAHOUT-187?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12766565#action_12766565 ] 

Sean Owen commented on MAHOUT-187:
----------------------------------

I agree, and now I am scratching my head to remember why on earth I would have written this. Let me think about it a sec but in all likelihood I will just make this change.

> RandomUtils>>isNotPrime throws IllegalArgumentException when argument is less than 2.
> -------------------------------------------------------------------------------------
>
>                 Key: MAHOUT-187
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-187
>             Project: Mahout
>          Issue Type: Bug
>    Affects Versions: 0.1
>            Reporter: Emerson Murphy-HIll
>             Fix For: 0.2
>
>
> I was using a FastMap, which happened to be empty, and rehash() was called.  Rehash eventually calls isNotPrime where n=1, which throws an illegal argument exception:
>   public static boolean isNotPrime(int n) {
>     if (n < 2) {
>       throw new IllegalArgumentException();
>     }
> It seems to me anything less than two is not prime.  Thus, I suggest:
>   public static boolean isNotPrime(int n) {
>     if (n < 2) {
>     	return true;
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (MAHOUT-187) RandomUtils>>isNotPrime throws IllegalArgumentException when argument is less than 2.

Posted by "Sean Owen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MAHOUT-187?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sean Owen updated MAHOUT-187:
-----------------------------

         Due Date: 16/Oct/09
    Fix Version/s: 0.2
         Assignee: Sean Owen

Oh heh I see this was already changed, by me, in SVN. It will go out with 0.2.

> RandomUtils>>isNotPrime throws IllegalArgumentException when argument is less than 2.
> -------------------------------------------------------------------------------------
>
>                 Key: MAHOUT-187
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-187
>             Project: Mahout
>          Issue Type: Bug
>    Affects Versions: 0.1
>            Reporter: Emerson Murphy-HIll
>            Assignee: Sean Owen
>             Fix For: 0.2
>
>
> I was using a FastMap, which happened to be empty, and rehash() was called.  Rehash eventually calls isNotPrime where n=1, which throws an illegal argument exception:
>   public static boolean isNotPrime(int n) {
>     if (n < 2) {
>       throw new IllegalArgumentException();
>     }
> It seems to me anything less than two is not prime.  Thus, I suggest:
>   public static boolean isNotPrime(int n) {
>     if (n < 2) {
>     	return true;
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.