Repository navigation
feat: generic vector math (sin, log, asin, acos, atan, atan2, xor_) - #6
Open
ShrutheeshIR wants to merge 1 commit into
Open
ShrutheeshIR wants to merge 1 commit into
ShrutheeshIR wants to merge 1 commit into
Conversation
ShrutheeshIR
commented
Nov 10, 2026
| inline static constexpr auto sqrt(VectorT v) noexcept -> VectorT | ||
| { | ||
| return _mm256_mul_ps(v, _mm256_rsqrt_ps(v)); | ||
| return _mm256_sqrt_ps(v); |
Author
There was a problem hiding this comment.
i have to do this since it messes with sqrt atan /acos operations, happy to have two versions, the proper sqrt operations for inverse trig, and retain this version for low-precision tasks
ShrutheeshIR
commented
Nov 10, 2026
| inline constexpr auto sqrt(const DataT &v) -> DataT | ||
| { | ||
| return v.sqrt(); | ||
| if constexpr (std::is_arithmetic_v<DataT>) |
Author
There was a problem hiding this comment.
A bunch of ops just to support scalar and vector math
ShrutheeshIR
commented
Nov 10, 2026
| } | ||
|
|
||
| template <typename DataA, typename DataB, typename DataC> | ||
| inline constexpr auto blend(const DataA &a, const DataB &b, const DataC &mask) -> DataA |
Author
There was a problem hiding this comment.
Need this for conditional statements that cricket spits out
…nd free min/max/fabs/blend Move sin and log out of the per-ISA backends into the shared Vector interface, so avx, neon and wasm use one implementation, and add asin, acos, atan, atan2 and xor_ (operator^). math.hh gains asin/acos/atan/atan2 and the scalar-or-vector free functions fabs, min, max and blend that generated robot code uses. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
zkingston
force-pushed
the
vector-math
branch
from
November 20, 2026 20:39
e04262b to
737edf1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Move sin and log out of per-ISA backends into the shared Vector interface, so avx, neon and wasm use one implementation.
Add asin, acos, atan, atan2 and xor_ (operator^). math.hh gains asin/acos/atan/atan2 and the scalar-or-vector free functions fabs, min, max and blend that generated robot code uses.