ecotyper.rcompat.fma

Fused multiply-add for numba kernels.

R and its packages are compiled with -O2 by clang/gfortran, which contract a*b + c inside one expression into a single fused multiply-add on arm64 (verified by disassembling NMF.so and stats.so: e.g. NMF’s divergence_update_H, stats::corcov and hclust_). Reproducing R bit-for-bit therefore requires FMAs at exactly those places; plain numba code never contracts, so kernels call fma() explicitly where R’s binaries do.

On platforms where R is not compiled with FMA contraction (e.g. x86-64 builds without -mfma) set ECOTYPER_NO_FMA=1 to use a*b + c instead.

Functions

fma(a, b, c)

a*b + c with a single rounding.

ecotyper.rcompat.fma.fma(a, b, c)[source]

a*b + c with a single rounding.