Question on Vector API and MemorySegment
Aurelian Tutuianu
padreati at yahoo.com
Tue Apr 23 10:00:11 UTC 2024
Hi everybody,
I am using Vector API to manipulate arrays for linear algebra purposes with stride arrays. I was considering to use directly MemorySegment but I found some APIs that does not exist for MemorySegment, but there are for arrays. Those methods are for loading and storing from a MemorySegment using an index map. This is really useful for stride arrays. Below is an example of code:
VectorSpecies<Double> vsd = DoubleVector.SPECIES_PREFERRED;
int[] indexes = new int[vsd.length()];
for (int i = 0; i < indexes.length; i++) {
indexes[i] = i * 2;
}
double[] array = new double[1000];
// read with index map elements 2 by 2
DoubleVector.fromArray(vsd, array, 0, indexes, 0);
MemorySegment ms = MemorySegment.ofArray(array);
// no possible to read with index map
vsd.fromMemorySegment(ms, 0, ByteOrder.nativeOrder());
Do you have in plan to implement those methods?
Thanks for everything. Best regards,Aurelian Tutuianu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20240423/9a5f5c00/attachment.htm>
More information about the panama-dev
mailing list