mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Remove assumption of std::complex for complex scalar types.
This commit is contained in:
@@ -497,7 +497,7 @@ class MatrixComplexPowerReturnValue;
|
||||
namespace internal {
|
||||
template <typename Scalar>
|
||||
struct stem_function {
|
||||
typedef std::complex<typename NumTraits<Scalar>::Real> ComplexScalar;
|
||||
typedef internal::make_complex_t<Scalar> ComplexScalar;
|
||||
typedef ComplexScalar type(ComplexScalar, int);
|
||||
};
|
||||
} // namespace internal
|
||||
|
||||
@@ -745,6 +745,9 @@ using std::is_constant_evaluated;
|
||||
constexpr bool is_constant_evaluated() { return false; }
|
||||
#endif
|
||||
|
||||
template <typename Scalar>
|
||||
using make_complex_t = std::conditional_t<NumTraits<Scalar>::IsComplex, Scalar, std::complex<Scalar>>;
|
||||
|
||||
} // end namespace internal
|
||||
|
||||
} // end namespace Eigen
|
||||
|
||||
@@ -885,8 +885,12 @@ struct scalar_div_cost {
|
||||
};
|
||||
|
||||
template <typename T, bool Vectorized>
|
||||
struct scalar_div_cost<std::complex<T>, Vectorized> {
|
||||
enum { value = 2 * scalar_div_cost<T>::value + 6 * NumTraits<T>::MulCost + 3 * NumTraits<T>::AddCost };
|
||||
struct scalar_div_cost<T, Vectorized, std::enable_if_t<NumTraits<T>::IsComplex>> {
|
||||
using RealScalar = typename NumTraits<T>::Real;
|
||||
enum {
|
||||
value =
|
||||
2 * scalar_div_cost<RealScalar>::value + 6 * NumTraits<RealScalar>::MulCost + 3 * NumTraits<RealScalar>::AddCost
|
||||
};
|
||||
};
|
||||
|
||||
template <bool Vectorized>
|
||||
|
||||
Reference in New Issue
Block a user