Skip to content

Commit

Permalink
feat: add a SupersetOf<f32> requirement for the ComplexField and Simd…
Browse files Browse the repository at this point in the history
…ComplexField traits
  • Loading branch information
sebcrozet committed Jun 22, 2024
1 parent 5bb3fd6 commit e2e5f0d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
- Add the `portable_simd` feature for supporting `std::simd`.
- The `ClosedAdd, ClosedMul, etc.` traits no longer require `AddAssign, MulAssign`. Instead they are required for new
traits named `ClosedAddAssign, ClosedMulAssign, etc.`
- The `ComplexField` and `SimdComplexField` (and, by extension, `RealField` and `SimdRealField`) traits now depend on the
`SupersetOf<f32>` trait in addition to `SupersetOf<f64>`.

## Release v0.8.1 (04 Apr. 2023)
- Add implementation of `rkyv` serialization/deserialization to the `Wide*` wrapper types.
Expand Down
1 change: 1 addition & 0 deletions src/scalar/complex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ macro_rules! complex_trait_methods (
#[allow(missing_docs)]
pub trait ComplexField:
SubsetOf<Self>
+ SupersetOf<f32>
+ SupersetOf<f64>
+ FromPrimitive
+ Field<Element=Self, SimdBool=bool>
Expand Down
29 changes: 15 additions & 14 deletions src/simd/simd_complex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,25 @@ use crate::simd::{SimdRealField, SimdValue};
/// Each lane of an SIMD complex field should contain one complex field.
#[allow(missing_docs)]
pub trait SimdComplexField:
SubsetOf<Self>
+ SupersetOf<f64>
+ Field
+ Clone
+ Neg<Output = Self>
SubsetOf<Self>
+ SupersetOf<f32>
+ SupersetOf<f64>
+ Field
+ Clone
+ Neg<Output=Self>
// + MeetSemilattice
// + JoinSemilattice
+ Send
+ Sync
+ Any
+ 'static
+ Debug
+ NumAssignOps
+ NumOps
+ PartialEq
+ Send
+ Sync
+ Any
+ 'static
+ Debug
+ NumAssignOps
+ NumOps
+ PartialEq
{
/// Type of the coefficients of a complex number.
type SimdRealField: SimdRealField<SimdBool = <Self as SimdValue>::SimdBool>;
type SimdRealField: SimdRealField<SimdBool=<Self as SimdValue>::SimdBool>;
complex_trait_methods!(SimdRealField, simd_);

/// Computes the sum of all the lanes of `self`.
Expand Down

0 comments on commit e2e5f0d

Please sign in to comment.