# commons-issues mailing list archives

##### Site index · List index
Message view
Top
From Sébastien Brisard (JIRA) <j...@apache.org>
Subject [jira] [Issue Comment Edited] (MATH-613) Equivalent of Blas DAXPY
Date Tue, 12 Jul 2011 03:26:59 GMT
```
[ 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.