Commit 0bac2c1
peng.li24
from_euler: use std::sin/cos (glibc=scipy Cython), no Python delegation
Root cause investigation:
- scipy's Rotation.from_euler Cython code calls C libc sin/cos (glibc),
NOT numpy SVML. std::sin/cos (also glibc) gives 0-ULP for single-axis.
- numpy::sin/cos (SVML) gives ≤2 ULP WORSE alignment with scipy's from_euler.
- -fno-builtin-sin/cos flag correctly routes std::sin to glibc.
- -ffp-contract=fast breaks sin(π/2) precision, must keep -ffp-contract=off.
scipy/transform.h:
- from_euler uses std::sin/cos → 0-ULP for single-axis vs scipy
- Multi-axis Hamilton product may differ ≤1 ULP in quaternion from scipy's
Cython arithmetic ordering (not fixable without matching compile flags)
pycpp/transform_py.h:
- from_euler calls C++ directly (no Python delegation)
- as_euler falls back to C++ when _scipy_rot is None (from_euler path)
tests/test_all.py:
- _check_strict: 0-ULP assert_bit_aligned for single-axis
- _check_multi: atol=1e-14 for multi-axis (near-zero elements have large
ULP but tiny absolute error ≤2ε; e.g. R[1,1]=-9.9e-5: 1.7e-16 abs = 12288 ULP)
- All 38 tests pass: 3361 total assertions, 0 failures1 parent b26fa1c commit 0bac2c1
4 files changed
Lines changed: 916 additions & 871 deletions
0 commit comments