-
Notifications
You must be signed in to change notification settings - Fork 0
Incubator Module
ExodusCoder9 edited this page Jun 20, 2026
·
1 revision
The math-incubator module contains experimental features that require --add-modules jdk.incubator.vector --enable-preview.
Uses jdk.incubator.vector.DoubleVector (SPECIES_256) for SIMD operations on Vector4d.
Vector4d sum = VectorApiMath.add(a, b);
Vector4d diff = VectorApiMath.sub(a, b);
Vector4d prod = VectorApiMath.mul(a, b);
Vector4d scaled = VectorApiMath.scale(v, s);
double dot = VectorApiMath.dot(a, b);
// Batch operation
VectorApiMath.batchAdd(results, inputsA, inputsB);
ParallelOps — Parallel Batch Operations
Uses StructuredTaskScope to parallelize vector operations across cores.
// Parallel batch addition (threshold: 4096 elements)
Vector3d[] results = ParallelOps.batchAddParallel(inputA, inputB);
// Falls back to sequential below threshold
MemoryOps — Off-Heap Memory Management
// Allocate
MemorySegment vec4 = MemoryOps.allocateVec4(arena);
MemorySegment array = MemoryOps.allocateVec4Array(arena, count);
// Write
MemoryOps.setVec4(segment, x, y, z, w);
// Read individual components
double x = MemoryOps.getVec4X(segment);
double y = MemoryOps.getVec4Y(segment);
double z = MemoryOps.getVec4Z(segment);
double w = MemoryOps.getVec4W(segment);