on-internet
← Community

How to get multiple values by index in an ojAlgo-array?

Stack Overflow ·

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 fir

Comments

Sign in or sign up to comment and upvote.

No comments yet.