Batch calculations in C++
Exercise the SIMD API, including a tail element outside a four-value group.
Prepare the consumer
Link the runtime ScientificNumberTools module and include ScientificNumberSIMD.h. The batch API is native C++; an example helper calling it from Blueprint is not a commercial SIMD Blueprint node.
Add five values
#include "ScientificNumberSIMD.h"
FScientificNumber A[] = {FScientificNumber(10), FScientificNumber(20),
FScientificNumber(30), FScientificNumber(40), FScientificNumber(50)};
FScientificNumber B[] = {FScientificNumber(1), FScientificNumber(2),
FScientificNumber(3), FScientificNumber(4), FScientificNumber(5)};
FScientificNumber Out[5];
FScientificNumberSIMD::BatchAdd(A, B, Out, 5);
Expected result
Out contains 11, 22, 33, 44 and 55. The fifth value exercises the tail beyond a group of four.
Check the other operators
| Operation on A | Expected result |
|---|---|
| BatchMultiplyScalar by 2 | 20, 40, 60, 80, 100 |
| BatchCompareGreater against B | All masks true |
| Sum | 150 |
| Min / Max | 10 / 50 |
| BatchNormalize | Same normalized numeric values |
Allocate output buffers for the requested count and respect the native signatures. Inspect GetCapabilities() instead of assuming a specific backend. Test on the hardware and build configuration you intend to ship. These operations retain the plugin’s numeric policy and precision limits.