Repository navigation
Prepare for freestanding mode by making complex support optional - #68
Open
danieltowner wants to merge 1 commit into
Open
danieltowner wants to merge 1 commit into
danieltowner wants to merge 1 commit into
Conversation
Contributor
Is the description incomplete? I guess something should go after "no", shouldn't it? |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block approval of the trait-based complex-type changes.
No open issues 🎉
What changed in this PR
Prepares xvec for future freestanding builds by decoupling complex-vector operations from std::complex, while preserving support for it.
Changes:
- Adds
complex_traits<T>as a customization point for complex-like types. - Updates generic and x86 implementations to use trait-based complex concepts and component types.
- Adds tests covering a user-defined complex type’s component access, comparison, conjugation, multiplication, and fused multiply-add.
| File | Description |
|---|---|
test/TestSimdComplex.cpp |
Adds coverage for a custom complex type enabled through traits. |
include/xvec/x86/x86_impl.hpp |
Generalizes complex arithmetic and comparison overloads. |
include/xvec/simd |
Uses traits to extract real and imaginary component types. |
include/xvec/generic/generic_impl.hpp |
Generalizes complex element access, fused multiply-add, and conjugation. |
include/xvec/detail/utilities.hpp |
Defines complex traits, their contract, and component-type helpers. |
include/xvec/detail/std_complex.hpp |
Uses trait-derived component types in rounding operations. |
include/xvec/detail/operators.hpp |
Uses traits for complex comparison component types. |
include/xvec/detail/core.hpp |
Makes conversion and vectorization checks trait-based. |
Review effort: Balanced
Contributor
Author
The text contained the angled brackets which weren't rendering properly. Now replaced by escaped angles. |
danieltowner
force-pushed
the
freestanding_complex
branch
2 times, most recently
from
November 20, 2026 17:29
5a3c963 to
c8e5e87
Compare
danieltowner
force-pushed
the
freestanding_complex
branch
2 times, most recently
from
November 21, 2026 17:34
ab17d89 to
2be10aa
Compare
Freestanding builds have no <complex>, so complex support must be easy to disable. To allow that, add a complex_traits<T> customisation point (std::complex is the only provided specialisation), define complex_number in terms of it, and use complex_number, vec_complex and complex_element_type instead of naming std::complex in the generic and x86 code. Behaviour for std::complex is unchanged.
danieltowner
force-pushed
the
freestanding_complex
branch
from
November 21, 2026 17:35
2be10aa to
3c6752c
Compare
This branch has not been deployed
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.
Freestanding builds have no <complex> header, so complex support must be easy to disable. To allow that, add a complex_traits<T> customisation point (std::complex is the only provided specialisation), define complex_number in terms of it, and use complex_number, vec_complex and complex_element_type instead of naming std::complex in the generic and x86 code. Behaviour for std::complex is unchanged.