complex_result_from_scalar for the built-in floating-point types

Đang mở
#779 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
62/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cpp
Lĩnh vực
backend

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
C++
Star
268
Fork
130
Merge trung bình
1 ngày 15 giờ
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của boostorg/multiprecision

Tất cả issue của boostorg/multiprecision

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.