-
Notifications
You must be signed in to change notification settings - Fork 22
[core][Complex] Improve Complex-number ecosystem #290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
shivasankarka
merged 269 commits into
Mojo-Numerics-and-Algorithms-group:pre-0.8
from
shivasankarka:complex
Dec 6, 2025
Merged
[core][Complex] Improve Complex-number ecosystem #290
shivasankarka
merged 269 commits into
Mojo-Numerics-and-Algorithms-group:pre-0.8
from
shivasankarka:complex
Dec 6, 2025
Conversation
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
Fix pre-commit issues
merging changes from docs branch
merge changes from upstream/pre-0.8
forfudan
approved these changes
Dec 6, 2025
Collaborator
forfudan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! Thanks!
0fd9b3f
into
Mojo-Numerics-and-Algorithms-group:pre-0.8
2 checks passed
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.
This PR expands complex-datatype support, improves ComplexSIMD and ComplexNDArray usability, introduces new convenience APIs, and enhances documentation across the complex-number ecosystem.
Added
ComplexDType & DType System
ComplexDType.int16,ComplexDType.int32).ComplexSIMD
Added
component_bitwidth()to distinguish SIMD bitwidth from the bitwidth of itsrealandimagcomponents.Added arithmetic operator overloads for more complete ComplexSIMD math support.
Added
elem_powfor per-component exponentiation (distinct from__pow__).Added
all_close()for comparing real and imaginary components across two ComplexSIMD instances.Added broadcasting support for scalar complex values, simplifying scalar construction:
Added convenience constructors:
ComplexSIMD[cf64].zero()ComplexSIMD[cf64].one()ComplexSIMD[cf64].I()ComplexSIMD[cf64].from_polar(2.0, 0.5)ComplexNDArray
ComplexNDArraymethods.Python-like Complex Literal
ImaginaryUnittype and the alias1jto enable natural, Pythonic complex number creation in NuMojo. Previously, creating complex numbers required explicit constructor calls which were pretty long, but now users can write mathematical expressions using familiar notation. The1jconstant automatically adapts to match operand types and SIMD widths. It also has full support for all operations between1jand scalars, SIMD vectors, and other complex numbers. It is by default of type ComplexDType.float64.NDArray Improvements
normalizefor handling negative indices.Changed
ComplexSIMD, including clearer conceptual explanations and usage examples.__getitem__,__setitem__,item,itemsetmethods ofComplexSIMD. The earlier method were confusing to use and were not flexible enough to access all parts of the complex SIMD vectors. The current methods allow accessing the ComplexSIMD vectors in the following manner,4. Removed