complex_result_from_scalar for the built-in floating-point types
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 62/100
Research direction
Start by locating complex_result_from_scalar and its existing multiprecision specializations in Boost.Multiprecision, then check how nearby traits and tests are organized. Add the built-in floating-point mappings proposed in the issue and verify the trait resolves to the matching std::complex type for float, double and long double; the issue does not name a test file.
Written by the indexing model from the issue text.
Description
complex_result_from_scalar<T> maps a multiprecision real type to its complex counterpart (cpp_bin_float_50 to cpp_complex_50, mpfr_float to mpc_complex, ...), but the primary template is left undefined, so it has no answer for the built-in types:
boost::multiprecision::complex_result_from_scalar<double>::type // error: incomplete type
Generic code that works for both, like Boost.Math's FFT, Chebyshev transform and polynomial root finders, therefore needs a second trait for the built-in half. Boost.Math currently carries one, tools::detail::complex_from_real, which picks std::complex<Real> for float, double and long double and forwards everything else to complex_result_from_scalar.
Could Multiprecision provide it instead?
template <> struct complex_result_from_scalar<float> { using type = std::complex<float>; };
template <> struct complex_result_from_scalar<double> { using type = std::complex<double>; };
template <> struct complex_result_from_scalar<long double> { using type = std::complex<long double>; };
template <class T>
using complex_result_from_scalar_t = typename complex_result_from_scalar<T>::type;
The primary template is currently incomplete, so these specialisations can't change the meaning of any code that compiles today. Boost.Math would then drop complex_from_real and use the Multiprecision trait directly.
🤖 Generated with Claude Code
- Dominant language
- C++
- Stars
- 268
- Forks
- 130
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 2
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from boostorg/multiprecision
-
cpp_bin_float fma rounds the product before the addition instead of fusingPossibly taken @NAThompson claimed this 43 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
boostorg/multiprecision#777 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
boostorg/multiprecision#775 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
boostorg/multiprecision#768 · 4 comments ·
-
Eigen NumTraits specialisation doesn't define max_digits10()Possibly taken @trestoncuzzort claimed this 28 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 45/100
boostorg/multiprecision#744 ·
-
`cpp_double_fp_backend` optimized single-limb operationsMay be free again @ckormanyos claimed this 462 days ago, and no pull request is open. Openenhancement optimization
boostorg/multiprecision#728 · 1 assignee ·
All issues in boostorg/multiprecision
Similar issues
-
agent:WSL code-review linux pri:medium refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
kind/enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
psi29a/d2decomped#691 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
CachyOS/packageinstaller#144 ·
Maintainers usually reply within 1 day
-
(S1 - Need confirmation)
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
CleverRaven/Cataclysm-DDA#89715 ·
Maintainers usually reply within 1 day