haskell / haskell/core-libraries-committee
`Complex` needs more specialization.
- Dominant language
- Haskell
- Stars
- 109
- Forks
- 20
- PR merge metrics
- No merged PRs in 30d
Description
The base module `Data.Complex` includes specializations of most numerical functions and instances for `Complex Double` and sometimes `Complex Float`. The current set omits three sorts of specializations that may have quite severe negative performance impacts on downstream code:
1. Many functions have specializations for `Complex Double` only, while downstream code would benefit from `Complex Float` as well.
2. The `Storable` instance has no specializations. This is problematic for a variety of downstream applications, e.g. this observed ~100x slow down of operations on storable vectors containing `Complex Double`s: https://github.com/haskell/vector/issues/558=
3. It is quite common for programs manipulating complex numbers to deal with fixed width integer types. `Complex Int8` and `Complex Int16` specializations would be very helpful (`Complex Int32` and `Complex Int64` perhaps less so).
Therefore I propose that base:
1. Add `SPECIALISE ... Complex Float` to the set of specialized functions and instances.
2. Add the `Storable` instance to the set of specialized functions and instances.
3. Add `SPECIALISE ... Complex Int{8,16}` to the set of specialized functions and instances.
4. Add `SPECIALISE ... ComplexInt{32,64}` to the set of specialized functions and instances if anyone can find a person or program who cares for them to be added.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating the base module Data.Complex and reviewing its existing specializations for Complex Double and Complex Float. Compare the numerical functions, instances, and Storable handling against the requested Complex Float and fixed-width integer cases; done means the agreed specializations are present and performance-sensitive downstream use no longer misses them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100