You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Niall Pemberton (JIRA)" <ji...@apache.org> on 2007/11/06 19:18:52 UTC

[jira] Created: (MATH-171) Merge (most of) ComplexUtils into Complex

Merge (most of) ComplexUtils into Complex
-----------------------------------------

                 Key: MATH-171
                 URL: https://issues.apache.org/jira/browse/MATH-171
             Project: Commons Math
          Issue Type: Improvement
    Affects Versions: 1.1
            Reporter: Niall Pemberton
            Priority: Minor
         Attachments: commons-math-complex-func.patch

All but two of the functions in ComplexUtils operate on a single Complex instance. I think it would make coding easier (esp. with an IDE) if the ComplexUtils functions were merged into Complex. For example, using the cos function changes from:

    Complex cosA = ComplexUtils.cos(a);
to
    Complex cosA = a.cos();


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


[jira] Updated: (MATH-171) Merge (most of) ComplexUtils into Complex

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

Niall Pemberton updated MATH-171:
---------------------------------

    Attachment: commons-math-complex-func.patch

> Merge (most of) ComplexUtils into Complex
> -----------------------------------------
>
>                 Key: MATH-171
>                 URL: https://issues.apache.org/jira/browse/MATH-171
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: 1.1
>            Reporter: Niall Pemberton
>            Priority: Minor
>         Attachments: commons-math-complex-func.patch
>
>
> All but two of the functions in ComplexUtils operate on a single Complex instance. I think it would make coding easier (esp. with an IDE) if the ComplexUtils functions were merged into Complex. For example, using the cos function changes from:
>     Complex cosA = ComplexUtils.cos(a);
> to
>     Complex cosA = a.cos();

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


[jira] Commented: (MATH-171) Merge (most of) ComplexUtils into Complex

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12540538 ] 

Niall Pemberton commented on MATH-171:
--------------------------------------

Another advantage is that it allows people to create alternative Complex instances, overriding the deafult implementation of functions (for example MATH-164) - having said that since these functions (and existing add(), subtract(), multiply(), divide() functions) create new Complex instances - then custom implementations would return the default implementation rather than the custom one - causing inconsistent behaviour. This is already a potential issue as it stands- I guess the solution would be to use a factory or add a factory method to Complex.

> Merge (most of) ComplexUtils into Complex
> -----------------------------------------
>
>                 Key: MATH-171
>                 URL: https://issues.apache.org/jira/browse/MATH-171
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: 1.1
>            Reporter: Niall Pemberton
>            Priority: Minor
>         Attachments: commons-math-complex-func.patch
>
>
> All but two of the functions in ComplexUtils operate on a single Complex instance. I think it would make coding easier (esp. with an IDE) if the ComplexUtils functions were merged into Complex. For example, using the cos function changes from:
>     Complex cosA = ComplexUtils.cos(a);
> to
>     Complex cosA = a.cos();

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


[jira] Updated: (MATH-171) Merge (most of) ComplexUtils into Complex

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

Niall Pemberton updated MATH-171:
---------------------------------

    Attachment: commons-math-complex-func-v2.patch

Attaching version 2 of patch which includes a factory method for Complex.

So to create a custom implementation....

public class MyComplex etends Complex {

    public MyComplex(double real, double imaginary) {
        super(real, imaginary);
    }

    // override/implement custom behaviour

    protected Complex createComplex(double real, double imaginary) {
        return new MyComplex(real, imaginary);
    }

}


> Merge (most of) ComplexUtils into Complex
> -----------------------------------------
>
>                 Key: MATH-171
>                 URL: https://issues.apache.org/jira/browse/MATH-171
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: 1.1
>            Reporter: Niall Pemberton
>            Priority: Minor
>         Attachments: commons-math-complex-func-v2.patch, commons-math-complex-func.patch
>
>
> All but two of the functions in ComplexUtils operate on a single Complex instance. I think it would make coding easier (esp. with an IDE) if the ComplexUtils functions were merged into Complex. For example, using the cos function changes from:
>     Complex cosA = ComplexUtils.cos(a);
> to
>     Complex cosA = a.cos();

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


[jira] Commented: (MATH-171) Merge (most of) ComplexUtils into Complex

Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12540645 ] 

Phil Steitz commented on MATH-171:
----------------------------------

Thanks, Niall!  

I am +1 for committing this, assuming others agree that it improves improves usability.   I don't see compatibility problems unless I am missing something. 

> Merge (most of) ComplexUtils into Complex
> -----------------------------------------
>
>                 Key: MATH-171
>                 URL: https://issues.apache.org/jira/browse/MATH-171
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: 1.1
>            Reporter: Niall Pemberton
>            Priority: Minor
>         Attachments: commons-math-complex-func-v2.patch, commons-math-complex-func.patch
>
>
> All but two of the functions in ComplexUtils operate on a single Complex instance. I think it would make coding easier (esp. with an IDE) if the ComplexUtils functions were merged into Complex. For example, using the cos function changes from:
>     Complex cosA = ComplexUtils.cos(a);
> to
>     Complex cosA = a.cos();

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


[jira] Resolved: (MATH-171) Merge (most of) ComplexUtils into Complex

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

Phil Steitz resolved MATH-171.
------------------------------

    Resolution: Fixed

(second) patch applied in  r596159
Thanks!

> Merge (most of) ComplexUtils into Complex
> -----------------------------------------
>
>                 Key: MATH-171
>                 URL: https://issues.apache.org/jira/browse/MATH-171
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: 1.1
>            Reporter: Niall Pemberton
>            Priority: Minor
>         Attachments: commons-math-complex-func-v2.patch, commons-math-complex-func.patch
>
>
> All but two of the functions in ComplexUtils operate on a single Complex instance. I think it would make coding easier (esp. with an IDE) if the ComplexUtils functions were merged into Complex. For example, using the cos function changes from:
>     Complex cosA = ComplexUtils.cos(a);
> to
>     Complex cosA = a.cos();

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


[jira] Commented: (MATH-171) Merge (most of) ComplexUtils into Complex

Posted by "Luc Maisonobe (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12541909 ] 

Luc Maisonobe commented on MATH-171:
------------------------------------

I agree too. Could this be commited for 1.2 ?

> Merge (most of) ComplexUtils into Complex
> -----------------------------------------
>
>                 Key: MATH-171
>                 URL: https://issues.apache.org/jira/browse/MATH-171
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: 1.1
>            Reporter: Niall Pemberton
>            Priority: Minor
>         Attachments: commons-math-complex-func-v2.patch, commons-math-complex-func.patch
>
>
> All but two of the functions in ComplexUtils operate on a single Complex instance. I think it would make coding easier (esp. with an IDE) if the ComplexUtils functions were merged into Complex. For example, using the cos function changes from:
>     Complex cosA = ComplexUtils.cos(a);
> to
>     Complex cosA = a.cos();

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