Skip to content

Replace Jacobi 3x3 eigensolver with closed form Cardano solution#758

Draft
kevinzakka wants to merge 1 commit intomainfrom
fix/pseudo-inertia-perf
Draft

Replace Jacobi 3x3 eigensolver with closed form Cardano solution#758
kevinzakka wants to merge 1 commit intomainfrom
fix/pseudo-inertia-perf

Conversation

@kevinzakka
Copy link
Collaborator

The iterative Jacobi eigensolver in dr.pseudo_inertia used Python level loops (5 sweeps x 3 rotations), each issuing small CUDA kernels whose launch overhead dominated wall time. This replaces it with Cardano's formula for eigenvalues and projector products for eigenvectors, eliminating all loops.

Benchmark (RTX 5070 Ti, 4096 envs x 12 bodies, 24 calls per collection):

Method Per collection Per call
Jacobi 232 ms 9.67 ms
Cardano 97 ms 4.03 ms

Fixes #757

@kevinzakka kevinzakka force-pushed the fix/pseudo-inertia-perf branch from 93939c3 to 3fd4dfa Compare March 9, 2026 05:09
The iterative Jacobi solver (5 sweeps x 3 rotations) used Python
level loops, each issuing small CUDA kernels whose launch overhead
dominated wall time. Replace with Cardano's formula for eigenvalues
and projector products for eigenvectors, reducing pseudo_inertia
overhead from 232 ms to 97 ms per collection (4096 envs x 12 bodies,
24 calls, RTX 5070 Ti).

Fixes #757
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pseudo_inertia Domain Randomization Causes Significant collection_time Increase

1 participant