commons-dev mailing list archives

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

I think some method names that represent operators are wrong, at least
inconsistent by naming and/or by implementation. I opend an issue:

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

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

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);


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message