On Sun, 3 Jan 2016 19:41:46 -0600, Ole Ersoy wrote:
Hi,
RealVector supports the following type of fluid API:
|RealVectorresult
=v.mapAddToSelf(3.4).mapToSelf(newTan()).mapToSelf(newPower(2.3));
IIUC each time we call v.mapXXX an iteration happens, so with the
above expression we loop 3 times. With Java 8 Arrays.setAll we can do
the same thing like this (Using static imports): ||Arrays.setAll(arr,
i -> pow(tan(arr[i] + 3.4), 2.3)); So that seems like a pretty good
fit for ArrayRealVector. WDYT? I have not looked at SparseRealVector
yet... Cheers, Ole |
||
[Above message is a tad mangled.]
result = v.mapToSelf(FunctionUtils.compose(new Power(2.3),
new Tan(),
FunctionUtils.combine(new
Add(),
new
Constant(3.4),
new
Identity())));
Feasible with one loop in CM: yes.
Less compact than the above syntax: yes.
Less efficient than the Java8 construct: I'd guess so...
Regards,
Gilles
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org