Closed audunska closed 6 months ago
Just asking the question helped me of course. I needed the bounds
where
AutoSimd<[R; WIDTH]>: SimdRealField<Element = R>,
R: RealField,
and it worked. The error messages were not very helpful though :)
My first point about needing the helper functions still stands.
I am closing this because I found answers to my questions myself. Sorry about the noise.
The splat function was indeed provided from the SimdValue
trait. Still missing the array conversions.
@audunska: thanks for posting your solution here. I think although simba
supports complex numbers, I believe it has seen far less attention than real numbers due to less use in applications, so there's probably a number of rough edges or missing functionality.
I am trying to write some numeric code generically over complex numbers, with explicit SIMD. The idea is to use a SoA representation, with
Complex<AutoSimd<[R; WIDTH]>>
, whereR
can bef32
orf64
, andWIDTH
will be4
or8
or similar. I want to keep it generic overR
, so the executable can pick whether to use single or double precision.I found this to be somewhat unergonomic. First of all, there are no built-in methods for directly constructing these complex SIMD-arrays. I had to create helper functions like:
Note the bound on the last function: The traits don't generically guarantee that
SimdValue::Element
is the obvious scalar type, so I had to add it as a bound.Now, when using this in a function, I'll need bounds like
which might not be that bad. But when trying to call a function with such a bound, the trait solver gets stuck somehow:
Is there a better way of working with generic complex numbers with SIMD?