-
Couldn't load subscription status.
- Fork 19
[core][ComplexNDArray] Improve ComplexNDArray methods #275
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
[core][ComplexNDArray] Improve ComplexNDArray methods #275
Conversation
fc38821 to
e3be4b1
Compare
e3be4b1 to
8d460a9
Compare
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.
Pull Request Overview
This PR enhances ComplexNDArray functionality by adding comparison operators, trait methods, statistical/reduction methods, and array manipulation capabilities. It also introduces temporary Int conversions for strides/shape operations and implements SIMD load/store methods for vectorized calculations.
Key Changes
- Added trait implementations (ImplicitlyCopyable, Movable) and conversion methods (bool, int, float) for ComplexNDArray
- Implemented magnitude-based comparison operators (lt, le, gt, ge) for complex arrays
- Added statistical methods (all, any, sum, prod, mean, max, min, argmax, argmin, cumsum, cumprod) and array manipulation methods (flatten, fill, row, col, clip, round, T, diagonal, trace, tolist, resize)
- Changed internal buffer types from
UnsafePointer[Int]toUnsafePointer[Scalar[DType.int]]in NDArrayShape, NDArrayStrides, and Item structs - Added SIMD load/store methods (load, store, unsafe_load, unsafe_store) for Item, Shape, and Strides
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| numojo/routines/indexing.mojo | Added Int conversions for stride operations in compress function |
| numojo/routines/creation.mojo | Removed duplicate import statements |
| numojo/core/ndstrides.mojo | Changed buffer type to Scalar[DType.int], updated setitem validation, added SIMD load/store methods |
| numojo/core/ndshape.mojo | Changed buffer type to Scalar[DType.int], updated setitem validation, added SIMD load/store methods, modified size_of_array calculation |
| numojo/core/ndarray.mojo | Added Int conversions for stride/shape buffer accesses throughout |
| numojo/core/item.mojo | Changed buffer type to Scalar[DType.int], removed Item.init(idx, shape) constructor and offset() method, added SIMD load/store methods |
| numojo/core/complex/complex_simd.mojo | Added ImplicitlyCopyable and Movable traits to ComplexSIMD |
| numojo/core/complex/complex_ndarray.mojo | Added comparison operators, conversion methods, power operations, statistical methods, and array manipulation methods; added Int conversions for stride operations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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.
Thank you for the changes!
I just noticed that Mojo renamed DType.index as DType.int now. It is a good though. I think in future maybe Int can be an alias for DType.int instead of being another independent type.
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.
Thank you for the changes!
I just noticed that Mojo renamed DType.index as DType.int now. It is a good though. I think in future maybe Int can be an alias for DType.int instead of being another independent type.
Yes! Mojo is moving toward a single |
ba0249e
into
Mojo-Numerics-and-Algorithms-group:pre-0.8
Pull Request Overview (From Copilot)
This PR enhances ComplexNDArray functionality by adding comparison operators, trait methods, statistical/reduction methods, and array manipulation capabilities. It also introduces temporary Int conversions for strides/shape operations and implements SIMD load/store methods for vectorized calculations.
Key Changes
UnsafePointer[Int]toUnsafePointer[Scalar[DType.int]]in NDArrayShape, NDArrayStrides, and Item structsShow a summary per file