commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ole Ersoy <ole.er...@gmail.com>
Subject [math] RealVector Fluid API vs. Java 8 Arrays.setAll
Date Mon, 04 Jan 2016 01:41:46 GMT
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 |

||


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message