You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sébastien Brisard (JIRA)" <ji...@apache.org> on 2011/07/11 13:25:59 UTC

[jira] [Created] (MATH-613) Equivalent of Blas DAXPY

Equivalent of Blas DAXPY
------------------------

                 Key: MATH-613
                 URL: https://issues.apache.org/jira/browse/MATH-613
             Project: Commons Math
          Issue Type: New Feature
    Affects Versions: 3.0
            Reporter: Sébastien Brisard
            Priority: Minor


In Blas, the method {{DAXPY}} computes an in-place linear combination of two vectors. More precisely, a call to {{DAXPY(a, x, y)}} updates vector {{y}} with the value of {{a * x + y}}. This can lead to very compact code, which I feel the need for in Commons-Math. However, DAXPY also has its limitations. For example, it cannot perform the other combination {{y <- x + a * y}}.
I think it would be useful that {{RealVector}} had a method for computing {{a * this + b * y}}, and storing the result in {{this}}. In the spirit of the {{mapToSelf}} method, I propose to create two new methods in {{Interface RealVector}}
{noformat}RealVector map(BivariateRealFunction f, RealVector y){noformat}
and
{noformat}RealVector mapToSelf(BivariateRealFunction f, RealVector y){noformat}
The former would return a new vector {{v}} such that
{noformat}v[i] <- f(this[i], y[i])}}{noformat}
and the latter would update {{this}},
{noformat}this[i] <- f(this[i], y[i]){noformat}
Emulating {{DAXPY}} would then simply be a matter of implementing the appropriate bivariate function.
While we are at it, how about
{noformat}RealVector map(TrivariateRealFunction f, RealVector y, RealVector z){noformat}
{noformat}RealVector mapToSelf(TrivariateRealFunction f, RealVector y, RealVector z){noformat}


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (MATH-613) Equivalent of Blas DAXPY

Posted by "Sébastien Brisard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-613?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13063391#comment-13063391 ] 

Sébastien Brisard commented on MATH-613:
----------------------------------------

Granted, trivariate versions are far-fetched, and not really needed (if the worst comes to the worst, two calls to the bivariate version should be enough, at least in the linear case).

As for going less general, restricting to a linear combination. I'm all for it, I just got the feeling that the discussion on the forum was leaning towards a more general, function-based approach (which is quite elegant).

If we restrict ourselves to linear combination, I'm not sure I understant your naming suggestion. I guess you speak sed fluently, and are in fact suggesting
{noformat}RealVector combine(double a, double b, RealVector y){noformat}
{noformat}RealVector combineToSelf(double a, double b, RealVector y){noformat}

That was my original suggestion, but someone mentioned that in {{FunctionUtils}}, "combine" really meant "compose multivariate with several univariate", so the above naming might be confusing. Actually, that's the reason why I went for general mapping: for lack of a better name in the linear case...

What do you think of {{linearlyCombine}} and {{linearlyCombineToSelf}}? I would personnaly prefer the first (shorter option).

> Equivalent of Blas DAXPY
> ------------------------
>
>                 Key: MATH-613
>                 URL: https://issues.apache.org/jira/browse/MATH-613
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>            Reporter: Sébastien Brisard
>            Priority: Minor
>              Labels: linear, vector
>
> In Blas, the method {{DAXPY}} computes an in-place linear combination of two vectors. More precisely, a call to {{DAXPY(a, x, y)}} updates vector {{y}} with the value of {{a * x + y}}. This can lead to very compact code, which I feel the need for in Commons-Math. However, DAXPY also has its limitations. For example, it cannot perform the other combination {{y <- x + a * y}}.
> I think it would be useful that {{RealVector}} had a method for computing {{a * this + b * y}}, and storing the result in {{this}}. In the spirit of the {{mapToSelf}} method, I propose to create two new methods in {{Interface RealVector}}
> {noformat}RealVector map(BivariateRealFunction f, RealVector y){noformat}
> and
> {noformat}RealVector mapToSelf(BivariateRealFunction f, RealVector y){noformat}
> The former would return a new vector {{v}} such that
> {noformat}v[i] <- f(this[i], y[i])}}{noformat}
> and the latter would update {{this}},
> {noformat}this[i] <- f(this[i], y[i]){noformat}
> Emulating {{DAXPY}} would then simply be a matter of implementing the appropriate bivariate function.
> While we are at it, how about
> {noformat}RealVector map(TrivariateRealFunction f, RealVector y, RealVector z){noformat}
> {noformat}RealVector mapToSelf(TrivariateRealFunction f, RealVector y, RealVector z){noformat}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Updated] (MATH-613) Equivalent of Blas DAXPY

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

Sébastien Brisard updated MATH-613:
-----------------------------------

    Attachment: MATH-613-20110727.patch

You're right. I've eliminated as much duplicate code as possible. This is indeed cleaner. Also checked the "Grant license to ASF" button...
Sorry for the mess.

> Equivalent of Blas DAXPY
> ------------------------
>
>                 Key: MATH-613
>                 URL: https://issues.apache.org/jira/browse/MATH-613
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>            Reporter: Sébastien Brisard
>            Priority: Minor
>              Labels: linear, vector
>         Attachments: MATH-613-20110727.patch, MATH-613-20110727.patch, MATH-613-20110727.patch
>
>
> In Blas, the method {{DAXPY}} computes an in-place linear combination of two vectors. More precisely, a call to {{DAXPY(a, x, y)}} updates vector {{y}} with the value of {{a * x + y}}. This can lead to very compact code, which I feel the need for in Commons-Math. However, DAXPY also has its limitations. For example, it cannot perform the other combination {{y <- x + a * y}}.
> I think it would be useful that {{RealVector}} had a method for computing {{a * this + b * y}}, and storing the result in {{this}}. In the spirit of the {{mapToSelf}} method, I propose to create two new methods in {{Interface RealVector}}
> {noformat}RealVector map(BivariateRealFunction f, RealVector y){noformat}
> and
> {noformat}RealVector mapToSelf(BivariateRealFunction f, RealVector y){noformat}
> The former would return a new vector {{v}} such that
> {noformat}v[i] <- f(this[i], y[i])}}{noformat}
> and the latter would update {{this}},
> {noformat}this[i] <- f(this[i], y[i]){noformat}
> Emulating {{DAXPY}} would then simply be a matter of implementing the appropriate bivariate function.
> While we are at it, how about
> {noformat}RealVector map(TrivariateRealFunction f, RealVector y, RealVector z){noformat}
> {noformat}RealVector mapToSelf(TrivariateRealFunction f, RealVector y, RealVector z){noformat}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (MATH-613) Equivalent of Blas DAXPY

Posted by "Gilles (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-613?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13071648#comment-13071648 ] 

Gilles commented on MATH-613:
-----------------------------

Sorry to be picky but I'm trying that we have a more uniform Javadoc style...
It would help if you please change comments like this:
{code}
* @param a
*            the weight of {@code this}
* @param b
*            the weight of {@code y}
* @param y
*            the vector with which {@code this} is linearly combined
* @return a vector containing {@code a * this[i] + b * y[i]} for all
*         {@code i}
{code}
into something like this:
{code}
* @param a Weight of {@code this}.
* @param b Weight of {@code y}.
* @param y Vector with which {@code this} is linearly combined.
* @return a vector containing {@code a * this[i] + b * y[i]} for all
* {@code i}.
{code}

I find the second alternative more legible, and it looks "finished".

I.e.
# Explanation on the same line as "@param". More balance and less "air".
# End sentences with a period. It's more consistent because if you need more the one sentence, you'll have to add periods anyways.
# Always exactly one space after the "*" character. A big space at the beginning of a line hinders legibility.

No, there is no document that documents how the documentation should be formatted. :(
We couldn't agree that it was worth formalizing rules beyond what was recommended by the Sun guidelines!


> Equivalent of Blas DAXPY
> ------------------------
>
>                 Key: MATH-613
>                 URL: https://issues.apache.org/jira/browse/MATH-613
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>            Reporter: Sébastien Brisard
>            Priority: Minor
>              Labels: linear, vector
>         Attachments: MATH-613-20110727.patch
>
>
> In Blas, the method {{DAXPY}} computes an in-place linear combination of two vectors. More precisely, a call to {{DAXPY(a, x, y)}} updates vector {{y}} with the value of {{a * x + y}}. This can lead to very compact code, which I feel the need for in Commons-Math. However, DAXPY also has its limitations. For example, it cannot perform the other combination {{y <- x + a * y}}.
> I think it would be useful that {{RealVector}} had a method for computing {{a * this + b * y}}, and storing the result in {{this}}. In the spirit of the {{mapToSelf}} method, I propose to create two new methods in {{Interface RealVector}}
> {noformat}RealVector map(BivariateRealFunction f, RealVector y){noformat}
> and
> {noformat}RealVector mapToSelf(BivariateRealFunction f, RealVector y){noformat}
> The former would return a new vector {{v}} such that
> {noformat}v[i] <- f(this[i], y[i])}}{noformat}
> and the latter would update {{this}},
> {noformat}this[i] <- f(this[i], y[i]){noformat}
> Emulating {{DAXPY}} would then simply be a matter of implementing the appropriate bivariate function.
> While we are at it, how about
> {noformat}RealVector map(TrivariateRealFunction f, RealVector y, RealVector z){noformat}
> {noformat}RealVector mapToSelf(TrivariateRealFunction f, RealVector y, RealVector z){noformat}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (MATH-613) Equivalent of Blas DAXPY

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

Phil Steitz commented on MATH-613:
----------------------------------

Final patch looks good to me, other than missing @throws for the DimensionMismatchExceptions, which we should add.  Thanks for the patch!

Out of curiosity, Sebastian, is it not possible for you to remove attachments that you added yourself (i.e., the earlier versions of the patch?)  This is really a JIRA access control question.

> Equivalent of Blas DAXPY
> ------------------------
>
>                 Key: MATH-613
>                 URL: https://issues.apache.org/jira/browse/MATH-613
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>            Reporter: Sébastien Brisard
>            Priority: Minor
>              Labels: linear, vector
>         Attachments: MATH-613-20110727.patch, MATH-613-20110727.patch, MATH-613-20110727.patch
>
>
> In Blas, the method {{DAXPY}} computes an in-place linear combination of two vectors. More precisely, a call to {{DAXPY(a, x, y)}} updates vector {{y}} with the value of {{a * x + y}}. This can lead to very compact code, which I feel the need for in Commons-Math. However, DAXPY also has its limitations. For example, it cannot perform the other combination {{y <- x + a * y}}.
> I think it would be useful that {{RealVector}} had a method for computing {{a * this + b * y}}, and storing the result in {{this}}. In the spirit of the {{mapToSelf}} method, I propose to create two new methods in {{Interface RealVector}}
> {noformat}RealVector map(BivariateRealFunction f, RealVector y){noformat}
> and
> {noformat}RealVector mapToSelf(BivariateRealFunction f, RealVector y){noformat}
> The former would return a new vector {{v}} such that
> {noformat}v[i] <- f(this[i], y[i])}}{noformat}
> and the latter would update {{this}},
> {noformat}this[i] <- f(this[i], y[i]){noformat}
> Emulating {{DAXPY}} would then simply be a matter of implementing the appropriate bivariate function.
> While we are at it, how about
> {noformat}RealVector map(TrivariateRealFunction f, RealVector y, RealVector z){noformat}
> {noformat}RealVector mapToSelf(TrivariateRealFunction f, RealVector y, RealVector z){noformat}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Resolved] (MATH-613) Equivalent of Blas DAXPY

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

Gilles resolved MATH-613.
-------------------------

       Resolution: Fixed
    Fix Version/s: 3.0

Committed in revision 1151665.


> Equivalent of Blas DAXPY
> ------------------------
>
>                 Key: MATH-613
>                 URL: https://issues.apache.org/jira/browse/MATH-613
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>            Reporter: Sébastien Brisard
>            Priority: Minor
>              Labels: linear, vector
>             Fix For: 3.0
>
>         Attachments: MATH-613-20110727.patch, MATH-613-20110727.patch, MATH-613-20110727.patch
>
>
> In Blas, the method {{DAXPY}} computes an in-place linear combination of two vectors. More precisely, a call to {{DAXPY(a, x, y)}} updates vector {{y}} with the value of {{a * x + y}}. This can lead to very compact code, which I feel the need for in Commons-Math. However, DAXPY also has its limitations. For example, it cannot perform the other combination {{y <- x + a * y}}.
> I think it would be useful that {{RealVector}} had a method for computing {{a * this + b * y}}, and storing the result in {{this}}. In the spirit of the {{mapToSelf}} method, I propose to create two new methods in {{Interface RealVector}}
> {noformat}RealVector map(BivariateRealFunction f, RealVector y){noformat}
> and
> {noformat}RealVector mapToSelf(BivariateRealFunction f, RealVector y){noformat}
> The former would return a new vector {{v}} such that
> {noformat}v[i] <- f(this[i], y[i])}}{noformat}
> and the latter would update {{this}},
> {noformat}this[i] <- f(this[i], y[i]){noformat}
> Emulating {{DAXPY}} would then simply be a matter of implementing the appropriate bivariate function.
> While we are at it, how about
> {noformat}RealVector map(TrivariateRealFunction f, RealVector y, RealVector z){noformat}
> {noformat}RealVector mapToSelf(TrivariateRealFunction f, RealVector y, RealVector z){noformat}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Updated] (MATH-613) Equivalent of Blas DAXPY

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

Sébastien Brisard updated MATH-613:
-----------------------------------

    Attachment: MATH-613-20110727.patch

Here is a patch for {{combine}} and {{combineToSelf}} (i.e. the linear, bivariate case).

> Equivalent of Blas DAXPY
> ------------------------
>
>                 Key: MATH-613
>                 URL: https://issues.apache.org/jira/browse/MATH-613
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>            Reporter: Sébastien Brisard
>            Priority: Minor
>              Labels: linear, vector
>         Attachments: MATH-613-20110727.patch
>
>
> In Blas, the method {{DAXPY}} computes an in-place linear combination of two vectors. More precisely, a call to {{DAXPY(a, x, y)}} updates vector {{y}} with the value of {{a * x + y}}. This can lead to very compact code, which I feel the need for in Commons-Math. However, DAXPY also has its limitations. For example, it cannot perform the other combination {{y <- x + a * y}}.
> I think it would be useful that {{RealVector}} had a method for computing {{a * this + b * y}}, and storing the result in {{this}}. In the spirit of the {{mapToSelf}} method, I propose to create two new methods in {{Interface RealVector}}
> {noformat}RealVector map(BivariateRealFunction f, RealVector y){noformat}
> and
> {noformat}RealVector mapToSelf(BivariateRealFunction f, RealVector y){noformat}
> The former would return a new vector {{v}} such that
> {noformat}v[i] <- f(this[i], y[i])}}{noformat}
> and the latter would update {{this}},
> {noformat}this[i] <- f(this[i], y[i]){noformat}
> Emulating {{DAXPY}} would then simply be a matter of implementing the appropriate bivariate function.
> While we are at it, how about
> {noformat}RealVector map(TrivariateRealFunction f, RealVector y, RealVector z){noformat}
> {noformat}RealVector mapToSelf(TrivariateRealFunction f, RealVector y, RealVector z){noformat}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Issue Comment Edited] (MATH-613) Equivalent of Blas DAXPY

Posted by "Sébastien Brisard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-613?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13063456#comment-13063456 ] 

Sébastien Brisard edited comment on MATH-613 at 7/12/11 3:25 AM:
-----------------------------------------------------------------

I have no experience whatsoever with Colt, but taking the element by element max of two vectors might be an example of use of the more general case (maybe). As for me, I'm happy with the linear case. And I like combine/combineToSelf.

      was (Author: celestin):
    I have no experience whatsoever with Colt, but I taking the element by element max of two vectors might be an example of use (maybe). As for me, I'm happy with the linear case. And I like combine/combineToSelf.
  
> Equivalent of Blas DAXPY
> ------------------------
>
>                 Key: MATH-613
>                 URL: https://issues.apache.org/jira/browse/MATH-613
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>            Reporter: Sébastien Brisard
>            Priority: Minor
>              Labels: linear, vector
>
> In Blas, the method {{DAXPY}} computes an in-place linear combination of two vectors. More precisely, a call to {{DAXPY(a, x, y)}} updates vector {{y}} with the value of {{a * x + y}}. This can lead to very compact code, which I feel the need for in Commons-Math. However, DAXPY also has its limitations. For example, it cannot perform the other combination {{y <- x + a * y}}.
> I think it would be useful that {{RealVector}} had a method for computing {{a * this + b * y}}, and storing the result in {{this}}. In the spirit of the {{mapToSelf}} method, I propose to create two new methods in {{Interface RealVector}}
> {noformat}RealVector map(BivariateRealFunction f, RealVector y){noformat}
> and
> {noformat}RealVector mapToSelf(BivariateRealFunction f, RealVector y){noformat}
> The former would return a new vector {{v}} such that
> {noformat}v[i] <- f(this[i], y[i])}}{noformat}
> and the latter would update {{this}},
> {noformat}this[i] <- f(this[i], y[i]){noformat}
> Emulating {{DAXPY}} would then simply be a matter of implementing the appropriate bivariate function.
> While we are at it, how about
> {noformat}RealVector map(TrivariateRealFunction f, RealVector y, RealVector z){noformat}
> {noformat}RealVector mapToSelf(TrivariateRealFunction f, RealVector y, RealVector z){noformat}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (MATH-613) Equivalent of Blas DAXPY

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

Phil Steitz commented on MATH-613:
----------------------------------

Don't worry at all about this, Sebastien.  I was just curious about what works and what does not.  Just keep the patches coming :)

> Equivalent of Blas DAXPY
> ------------------------
>
>                 Key: MATH-613
>                 URL: https://issues.apache.org/jira/browse/MATH-613
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>            Reporter: Sébastien Brisard
>            Priority: Minor
>              Labels: linear, vector
>         Attachments: MATH-613-20110727.patch, MATH-613-20110727.patch, MATH-613-20110727.patch
>
>
> In Blas, the method {{DAXPY}} computes an in-place linear combination of two vectors. More precisely, a call to {{DAXPY(a, x, y)}} updates vector {{y}} with the value of {{a * x + y}}. This can lead to very compact code, which I feel the need for in Commons-Math. However, DAXPY also has its limitations. For example, it cannot perform the other combination {{y <- x + a * y}}.
> I think it would be useful that {{RealVector}} had a method for computing {{a * this + b * y}}, and storing the result in {{this}}. In the spirit of the {{mapToSelf}} method, I propose to create two new methods in {{Interface RealVector}}
> {noformat}RealVector map(BivariateRealFunction f, RealVector y){noformat}
> and
> {noformat}RealVector mapToSelf(BivariateRealFunction f, RealVector y){noformat}
> The former would return a new vector {{v}} such that
> {noformat}v[i] <- f(this[i], y[i])}}{noformat}
> and the latter would update {{this}},
> {noformat}this[i] <- f(this[i], y[i]){noformat}
> Emulating {{DAXPY}} would then simply be a matter of implementing the appropriate bivariate function.
> While we are at it, how about
> {noformat}RealVector map(TrivariateRealFunction f, RealVector y, RealVector z){noformat}
> {noformat}RealVector mapToSelf(TrivariateRealFunction f, RealVector y, RealVector z){noformat}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (MATH-613) Equivalent of Blas DAXPY

Posted by "Sébastien Brisard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-613?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13071939#comment-13071939 ] 

Sébastien Brisard commented on MATH-613:
----------------------------------------

I'm sorry, I really can't find the way to do it. In a previous issue (which is even messier), someone suggested that I should give all patches the same name, but this obviously does not work.
I'll probably need some time until my proposals are OK at the first attempt. Meanwhile, is there another way to propose patches, and attach the "final" patch only to the JIRA issue?
Sebastien

> Equivalent of Blas DAXPY
> ------------------------
>
>                 Key: MATH-613
>                 URL: https://issues.apache.org/jira/browse/MATH-613
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>            Reporter: Sébastien Brisard
>            Priority: Minor
>              Labels: linear, vector
>         Attachments: MATH-613-20110727.patch, MATH-613-20110727.patch, MATH-613-20110727.patch
>
>
> In Blas, the method {{DAXPY}} computes an in-place linear combination of two vectors. More precisely, a call to {{DAXPY(a, x, y)}} updates vector {{y}} with the value of {{a * x + y}}. This can lead to very compact code, which I feel the need for in Commons-Math. However, DAXPY also has its limitations. For example, it cannot perform the other combination {{y <- x + a * y}}.
> I think it would be useful that {{RealVector}} had a method for computing {{a * this + b * y}}, and storing the result in {{this}}. In the spirit of the {{mapToSelf}} method, I propose to create two new methods in {{Interface RealVector}}
> {noformat}RealVector map(BivariateRealFunction f, RealVector y){noformat}
> and
> {noformat}RealVector mapToSelf(BivariateRealFunction f, RealVector y){noformat}
> The former would return a new vector {{v}} such that
> {noformat}v[i] <- f(this[i], y[i])}}{noformat}
> and the latter would update {{this}},
> {noformat}this[i] <- f(this[i], y[i]){noformat}
> Emulating {{DAXPY}} would then simply be a matter of implementing the appropriate bivariate function.
> While we are at it, how about
> {noformat}RealVector map(TrivariateRealFunction f, RealVector y, RealVector z){noformat}
> {noformat}RealVector mapToSelf(TrivariateRealFunction f, RealVector y, RealVector z){noformat}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (MATH-613) Equivalent of Blas DAXPY

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

Phil Steitz commented on MATH-613:
----------------------------------

I see the value of this based on the linear combination example, so am +0 to add the first two. It might be better, though to s/map/combine in the names.  It might also be good to explicitly name the linear combination example.  Are there other examples likely to be commonly used that anyone can think of?  If not, we should consider adding only the linear combination, since if that is all anyone will use, it will simplify the API to just name and add it.

Regarding the trivariate versions, what exactly are the use cases?

> Equivalent of Blas DAXPY
> ------------------------
>
>                 Key: MATH-613
>                 URL: https://issues.apache.org/jira/browse/MATH-613
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>            Reporter: Sébastien Brisard
>            Priority: Minor
>              Labels: linear, vector
>
> In Blas, the method {{DAXPY}} computes an in-place linear combination of two vectors. More precisely, a call to {{DAXPY(a, x, y)}} updates vector {{y}} with the value of {{a * x + y}}. This can lead to very compact code, which I feel the need for in Commons-Math. However, DAXPY also has its limitations. For example, it cannot perform the other combination {{y <- x + a * y}}.
> I think it would be useful that {{RealVector}} had a method for computing {{a * this + b * y}}, and storing the result in {{this}}. In the spirit of the {{mapToSelf}} method, I propose to create two new methods in {{Interface RealVector}}
> {noformat}RealVector map(BivariateRealFunction f, RealVector y){noformat}
> and
> {noformat}RealVector mapToSelf(BivariateRealFunction f, RealVector y){noformat}
> The former would return a new vector {{v}} such that
> {noformat}v[i] <- f(this[i], y[i])}}{noformat}
> and the latter would update {{this}},
> {noformat}this[i] <- f(this[i], y[i]){noformat}
> Emulating {{DAXPY}} would then simply be a matter of implementing the appropriate bivariate function.
> While we are at it, how about
> {noformat}RealVector map(TrivariateRealFunction f, RealVector y, RealVector z){noformat}
> {noformat}RealVector mapToSelf(TrivariateRealFunction f, RealVector y, RealVector z){noformat}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (MATH-613) Equivalent of Blas DAXPY

Posted by "Sébastien Brisard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-613?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13063456#comment-13063456 ] 

Sébastien Brisard commented on MATH-613:
----------------------------------------

I have no experience whatsoever with Colt, but I taking the element by element max of two vectors might be an example of use (maybe). As for me, I'm happy with the linear case. And I like combine/combineToSelf.

> Equivalent of Blas DAXPY
> ------------------------
>
>                 Key: MATH-613
>                 URL: https://issues.apache.org/jira/browse/MATH-613
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>            Reporter: Sébastien Brisard
>            Priority: Minor
>              Labels: linear, vector
>
> In Blas, the method {{DAXPY}} computes an in-place linear combination of two vectors. More precisely, a call to {{DAXPY(a, x, y)}} updates vector {{y}} with the value of {{a * x + y}}. This can lead to very compact code, which I feel the need for in Commons-Math. However, DAXPY also has its limitations. For example, it cannot perform the other combination {{y <- x + a * y}}.
> I think it would be useful that {{RealVector}} had a method for computing {{a * this + b * y}}, and storing the result in {{this}}. In the spirit of the {{mapToSelf}} method, I propose to create two new methods in {{Interface RealVector}}
> {noformat}RealVector map(BivariateRealFunction f, RealVector y){noformat}
> and
> {noformat}RealVector mapToSelf(BivariateRealFunction f, RealVector y){noformat}
> The former would return a new vector {{v}} such that
> {noformat}v[i] <- f(this[i], y[i])}}{noformat}
> and the latter would update {{this}},
> {noformat}this[i] <- f(this[i], y[i]){noformat}
> Emulating {{DAXPY}} would then simply be a matter of implementing the appropriate bivariate function.
> While we are at it, how about
> {noformat}RealVector map(TrivariateRealFunction f, RealVector y, RealVector z){noformat}
> {noformat}RealVector mapToSelf(TrivariateRealFunction f, RealVector y, RealVector z){noformat}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Issue Comment Edited] (MATH-613) Equivalent of Blas DAXPY

Posted by "Sébastien Brisard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-613?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13071590#comment-13071590 ] 

Sébastien Brisard edited comment on MATH-613 at 7/27/11 7:51 AM:
-----------------------------------------------------------------

Here is a patch for {{combine}} and {{combineToSelf}} (i.e. the linear, bivariate case). File name is {{MATH-613-20110727.patch}}.

      was (Author: celestin):
    Here is a patch for {{combine}} and {{combineToSelf}} (i.e. the linear, bivariate case).
  
> Equivalent of Blas DAXPY
> ------------------------
>
>                 Key: MATH-613
>                 URL: https://issues.apache.org/jira/browse/MATH-613
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>            Reporter: Sébastien Brisard
>            Priority: Minor
>              Labels: linear, vector
>         Attachments: MATH-613-20110727.patch
>
>
> In Blas, the method {{DAXPY}} computes an in-place linear combination of two vectors. More precisely, a call to {{DAXPY(a, x, y)}} updates vector {{y}} with the value of {{a * x + y}}. This can lead to very compact code, which I feel the need for in Commons-Math. However, DAXPY also has its limitations. For example, it cannot perform the other combination {{y <- x + a * y}}.
> I think it would be useful that {{RealVector}} had a method for computing {{a * this + b * y}}, and storing the result in {{this}}. In the spirit of the {{mapToSelf}} method, I propose to create two new methods in {{Interface RealVector}}
> {noformat}RealVector map(BivariateRealFunction f, RealVector y){noformat}
> and
> {noformat}RealVector mapToSelf(BivariateRealFunction f, RealVector y){noformat}
> The former would return a new vector {{v}} such that
> {noformat}v[i] <- f(this[i], y[i])}}{noformat}
> and the latter would update {{this}},
> {noformat}this[i] <- f(this[i], y[i]){noformat}
> Emulating {{DAXPY}} would then simply be a matter of implementing the appropriate bivariate function.
> While we are at it, how about
> {noformat}RealVector map(TrivariateRealFunction f, RealVector y, RealVector z){noformat}
> {noformat}RealVector mapToSelf(TrivariateRealFunction f, RealVector y, RealVector z){noformat}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (MATH-613) Equivalent of Blas DAXPY

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

Phil Steitz commented on MATH-613:
----------------------------------

Sorry, I missed the earlier comment on the name. Regarding whether or not to implement the general version, I would like to know if others have actual use cases in mind.  Ted mentioned in the earlier thread that Colt had a similar API.  I am curious how it was actually used, beyond the canonical linear combination example that led to this suggestion. Can anyone think of practical use cases for the general versions?

Regarding the name, I did mean "combine."  I don't personally see a problem using "combine" here as well as FunctionUtils in the analysis package, as the objects are different.  But if we need to add something, I would add "with" - i.e. "combineWith" and "combineWithSelf."

Don't allow me to prematurely nix the general case, though. I just want some indication that the slightly more complex (hence less approachable) API has enough usefulness to justify it.

> Equivalent of Blas DAXPY
> ------------------------
>
>                 Key: MATH-613
>                 URL: https://issues.apache.org/jira/browse/MATH-613
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>            Reporter: Sébastien Brisard
>            Priority: Minor
>              Labels: linear, vector
>
> In Blas, the method {{DAXPY}} computes an in-place linear combination of two vectors. More precisely, a call to {{DAXPY(a, x, y)}} updates vector {{y}} with the value of {{a * x + y}}. This can lead to very compact code, which I feel the need for in Commons-Math. However, DAXPY also has its limitations. For example, it cannot perform the other combination {{y <- x + a * y}}.
> I think it would be useful that {{RealVector}} had a method for computing {{a * this + b * y}}, and storing the result in {{this}}. In the spirit of the {{mapToSelf}} method, I propose to create two new methods in {{Interface RealVector}}
> {noformat}RealVector map(BivariateRealFunction f, RealVector y){noformat}
> and
> {noformat}RealVector mapToSelf(BivariateRealFunction f, RealVector y){noformat}
> The former would return a new vector {{v}} such that
> {noformat}v[i] <- f(this[i], y[i])}}{noformat}
> and the latter would update {{this}},
> {noformat}this[i] <- f(this[i], y[i]){noformat}
> Emulating {{DAXPY}} would then simply be a matter of implementing the appropriate bivariate function.
> While we are at it, how about
> {noformat}RealVector map(TrivariateRealFunction f, RealVector y, RealVector z){noformat}
> {noformat}RealVector mapToSelf(TrivariateRealFunction f, RealVector y, RealVector z){noformat}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (MATH-613) Equivalent of Blas DAXPY

Posted by "Gilles (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-613?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13071736#comment-13071736 ] 

Gilles commented on MATH-613:
-----------------------------

The code would be leaner if the loop were implemented once, e.g. in "combine(double,double,double[])", instead of for each overloaded version of "combine". Of course, there would be the penalty of an additional method call, but do you think that it would be noticeable? [Maybe a good example for micro-benchmarking...].


> Equivalent of Blas DAXPY
> ------------------------
>
>                 Key: MATH-613
>                 URL: https://issues.apache.org/jira/browse/MATH-613
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>            Reporter: Sébastien Brisard
>            Priority: Minor
>              Labels: linear, vector
>         Attachments: MATH-613-20110727.patch, MATH-613-20110727.patch
>
>
> In Blas, the method {{DAXPY}} computes an in-place linear combination of two vectors. More precisely, a call to {{DAXPY(a, x, y)}} updates vector {{y}} with the value of {{a * x + y}}. This can lead to very compact code, which I feel the need for in Commons-Math. However, DAXPY also has its limitations. For example, it cannot perform the other combination {{y <- x + a * y}}.
> I think it would be useful that {{RealVector}} had a method for computing {{a * this + b * y}}, and storing the result in {{this}}. In the spirit of the {{mapToSelf}} method, I propose to create two new methods in {{Interface RealVector}}
> {noformat}RealVector map(BivariateRealFunction f, RealVector y){noformat}
> and
> {noformat}RealVector mapToSelf(BivariateRealFunction f, RealVector y){noformat}
> The former would return a new vector {{v}} such that
> {noformat}v[i] <- f(this[i], y[i])}}{noformat}
> and the latter would update {{this}},
> {noformat}this[i] <- f(this[i], y[i]){noformat}
> Emulating {{DAXPY}} would then simply be a matter of implementing the appropriate bivariate function.
> While we are at it, how about
> {noformat}RealVector map(TrivariateRealFunction f, RealVector y, RealVector z){noformat}
> {noformat}RealVector mapToSelf(TrivariateRealFunction f, RealVector y, RealVector z){noformat}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Updated] (MATH-613) Equivalent of Blas DAXPY

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

Sébastien Brisard updated MATH-613:
-----------------------------------

    Attachment: MATH-613-20110727.patch

You *should* be picky! Thanks for reviewing the code. I updated it according to your comments, hope I didn't forget anything. Best regards,
Sebastien

> Equivalent of Blas DAXPY
> ------------------------
>
>                 Key: MATH-613
>                 URL: https://issues.apache.org/jira/browse/MATH-613
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>            Reporter: Sébastien Brisard
>            Priority: Minor
>              Labels: linear, vector
>         Attachments: MATH-613-20110727.patch, MATH-613-20110727.patch
>
>
> In Blas, the method {{DAXPY}} computes an in-place linear combination of two vectors. More precisely, a call to {{DAXPY(a, x, y)}} updates vector {{y}} with the value of {{a * x + y}}. This can lead to very compact code, which I feel the need for in Commons-Math. However, DAXPY also has its limitations. For example, it cannot perform the other combination {{y <- x + a * y}}.
> I think it would be useful that {{RealVector}} had a method for computing {{a * this + b * y}}, and storing the result in {{this}}. In the spirit of the {{mapToSelf}} method, I propose to create two new methods in {{Interface RealVector}}
> {noformat}RealVector map(BivariateRealFunction f, RealVector y){noformat}
> and
> {noformat}RealVector mapToSelf(BivariateRealFunction f, RealVector y){noformat}
> The former would return a new vector {{v}} such that
> {noformat}v[i] <- f(this[i], y[i])}}{noformat}
> and the latter would update {{this}},
> {noformat}this[i] <- f(this[i], y[i]){noformat}
> Emulating {{DAXPY}} would then simply be a matter of implementing the appropriate bivariate function.
> While we are at it, how about
> {noformat}RealVector map(TrivariateRealFunction f, RealVector y, RealVector z){noformat}
> {noformat}RealVector mapToSelf(TrivariateRealFunction f, RealVector y, RealVector z){noformat}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (MATH-613) Equivalent of Blas DAXPY

Posted by "Gilles (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-613?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13071696#comment-13071696 ] 

Gilles commented on MATH-613:
-----------------------------

{quote}
You should be picky!
{quote}
So... I think that you forgot to click on "Grant license to ASF for inclusion [...]" when attaching the diff file.


> Equivalent of Blas DAXPY
> ------------------------
>
>                 Key: MATH-613
>                 URL: https://issues.apache.org/jira/browse/MATH-613
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>            Reporter: Sébastien Brisard
>            Priority: Minor
>              Labels: linear, vector
>         Attachments: MATH-613-20110727.patch, MATH-613-20110727.patch
>
>
> In Blas, the method {{DAXPY}} computes an in-place linear combination of two vectors. More precisely, a call to {{DAXPY(a, x, y)}} updates vector {{y}} with the value of {{a * x + y}}. This can lead to very compact code, which I feel the need for in Commons-Math. However, DAXPY also has its limitations. For example, it cannot perform the other combination {{y <- x + a * y}}.
> I think it would be useful that {{RealVector}} had a method for computing {{a * this + b * y}}, and storing the result in {{this}}. In the spirit of the {{mapToSelf}} method, I propose to create two new methods in {{Interface RealVector}}
> {noformat}RealVector map(BivariateRealFunction f, RealVector y){noformat}
> and
> {noformat}RealVector mapToSelf(BivariateRealFunction f, RealVector y){noformat}
> The former would return a new vector {{v}} such that
> {noformat}v[i] <- f(this[i], y[i])}}{noformat}
> and the latter would update {{this}},
> {noformat}this[i] <- f(this[i], y[i]){noformat}
> Emulating {{DAXPY}} would then simply be a matter of implementing the appropriate bivariate function.
> While we are at it, how about
> {noformat}RealVector map(TrivariateRealFunction f, RealVector y, RealVector z){noformat}
> {noformat}RealVector mapToSelf(TrivariateRealFunction f, RealVector y, RealVector z){noformat}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (MATH-613) Equivalent of Blas DAXPY

Posted by "Sébastien Brisard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-613?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13071775#comment-13071775 ] 

Sébastien Brisard commented on MATH-613:
----------------------------------------

Also, just noticed that giving the same name to successively submitted files does *not* override them, so there are three different patches with the same name... I'm even sorrier for the mess.

> Equivalent of Blas DAXPY
> ------------------------
>
>                 Key: MATH-613
>                 URL: https://issues.apache.org/jira/browse/MATH-613
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.0
>            Reporter: Sébastien Brisard
>            Priority: Minor
>              Labels: linear, vector
>         Attachments: MATH-613-20110727.patch, MATH-613-20110727.patch, MATH-613-20110727.patch
>
>
> In Blas, the method {{DAXPY}} computes an in-place linear combination of two vectors. More precisely, a call to {{DAXPY(a, x, y)}} updates vector {{y}} with the value of {{a * x + y}}. This can lead to very compact code, which I feel the need for in Commons-Math. However, DAXPY also has its limitations. For example, it cannot perform the other combination {{y <- x + a * y}}.
> I think it would be useful that {{RealVector}} had a method for computing {{a * this + b * y}}, and storing the result in {{this}}. In the spirit of the {{mapToSelf}} method, I propose to create two new methods in {{Interface RealVector}}
> {noformat}RealVector map(BivariateRealFunction f, RealVector y){noformat}
> and
> {noformat}RealVector mapToSelf(BivariateRealFunction f, RealVector y){noformat}
> The former would return a new vector {{v}} such that
> {noformat}v[i] <- f(this[i], y[i])}}{noformat}
> and the latter would update {{this}},
> {noformat}this[i] <- f(this[i], y[i]){noformat}
> Emulating {{DAXPY}} would then simply be a matter of implementing the appropriate bivariate function.
> While we are at it, how about
> {noformat}RealVector map(TrivariateRealFunction f, RealVector y, RealVector z){noformat}
> {noformat}RealVector mapToSelf(TrivariateRealFunction f, RealVector y, RealVector z){noformat}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira