commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arne Ploese <aplo...@gmx.de>
Subject [math] Rename operator methods of RealVector
Date Tue, 09 Aug 2011 19:07:00 GMT
Hi,

I think some method names that represent operators are wrong, at least
inconsistent by naming and/or by implementation. I opend an issue:
https://issues.apache.org/jira/browse/MATH-643



Comming from matlab/octave the octave operator .+ is specified ad
element-by-element addition. 

http://www.gnu.org/software/octave/doc/interpreter/Arithmetic-Ops.html#Arithmetic-Ops

If one argument is a scalar this will be applied to all entries of the
matrix (here vector). if the if both are matricies (here vectors) the
dimensions must agree, then all entries are added element-by-element. 
mapAdd() is for me confusing.

The method map(), which maps a function to each entry is OK, but what is
mapAdd() in an interface? - In the implementation of
Abstractrealvector.mapAddToSelf() is the class Add as 
function call used, but this is only relevant for the implementation and
should not leak into the interface.

So add() should become ebeAdd(). Or add ebeAdd()?
For all add() operands addToSelf() is missing - mapAdd() provides
this.  

Here is the current naming:

RealVector add(double[] v);
RealVector add(RealVector v);
RealVector mapAdd(double d);
RealVector mapAddToSelf(double d);


RealVector ebeMultiply(RealVector v);
RealVector ebeMultiply(double[] v);
RealVector mapMultiply(double d);
RealVector mapMultiplyToSelf(double d);

This should be renamed to:

RealVector ebeAdd(double[] v);
RealVector ebeAddToSelf(double[] v);
RealVector ebeAdd(RealVector v);
RealVector ebeAddToSelf(RealVector v);
RealVector ebeAdd(double d);
RealVector ebeAddToSelf(double d);

RealVector ebeMultiply(RealVector v);
RealVector ebeMultiplyToSelf(RealVector v);
RealVector ebeMultiply(double[] v);
RealVector ebeMultiplyToSelf(double[] v);
RealVector ebeMultiply(double d);
RealVector ebeMultiplyToSelf(double d);


Arne



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message