[
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