Let's say I have an ojAlgo-array defined like this
ArrayAnyD<Double> regularArray = ArrayAnyD.PRIMITIVE64.make(10);
regularArray.loopAll((final long[] ref) -> regularArray.set(ref, ref[0]*ref[0]));
which just contains the squares of the numbers from 0 to 9, and some indexes:
long[] idxs = {1, 3, 4, 7, 9}
Now, I'd like to do something akin to
slicedArray = regularArray[idxs]
which should give me another Array containing 1.0, 9.0, 16.0, 49.0, 81.0
. How would I do that with ojAlgo?
regularArray.get(idxs)
only gives me the first value.regularArray.sliceSet(idxs, 0)
returns all values from the first one onwards and ignores the following indexes.
I suspect I'd need to use some form of regularArray.loop or .loopAll, but I'm not sure how to make it work
Here's some of what you can do:
To do all of that (exactly that way) you need v51.3.0-SNAPSHOT or later.