mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-01-18 14:34:17 +08:00
remove support for type std::complex<int>. Simplify NumTraits accordingly.
This commit is contained in:
parent
5f0af72abc
commit
0f2df4b202
@ -84,7 +84,7 @@ typename NumTraits<Scalar>::Real Object<Scalar, Derived>::norm2() const
|
||||
template<typename Scalar, typename Derived>
|
||||
typename NumTraits<Scalar>::Real Object<Scalar, Derived>::norm() const
|
||||
{
|
||||
return NumTraits<typename NumTraits<Scalar>::Real>::sqrt(norm2());
|
||||
return std::sqrt(norm2());
|
||||
}
|
||||
|
||||
template<typename Scalar, typename Derived>
|
||||
|
@ -110,7 +110,6 @@ EI_MAKE_TYPEDEFS(Type, TypeSuffix, Dynamic, X)
|
||||
EI_MAKE_TYPEDEFS_ALL_SIZES(int, i)
|
||||
EI_MAKE_TYPEDEFS_ALL_SIZES(float, f)
|
||||
EI_MAKE_TYPEDEFS_ALL_SIZES(double, d)
|
||||
EI_MAKE_TYPEDEFS_ALL_SIZES(std::complex<int>, ci)
|
||||
EI_MAKE_TYPEDEFS_ALL_SIZES(std::complex<float>, cf)
|
||||
EI_MAKE_TYPEDEFS_ALL_SIZES(std::complex<double>, cd)
|
||||
|
||||
@ -132,7 +131,6 @@ EI_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, X)
|
||||
EI_USING_MATRIX_TYPEDEFS_FOR_TYPE(i) \
|
||||
EI_USING_MATRIX_TYPEDEFS_FOR_TYPE(f) \
|
||||
EI_USING_MATRIX_TYPEDEFS_FOR_TYPE(d) \
|
||||
EI_USING_MATRIX_TYPEDEFS_FOR_TYPE(ci) \
|
||||
EI_USING_MATRIX_TYPEDEFS_FOR_TYPE(cf) \
|
||||
EI_USING_MATRIX_TYPEDEFS_FOR_TYPE(cd)
|
||||
|
||||
|
@ -42,8 +42,6 @@ template<> struct NumTraits<int>
|
||||
static int real(const int& x) { return x; }
|
||||
static int imag(const int& x) { EI_UNUSED(x); return 0; }
|
||||
static int conj(const int& x) { return x; }
|
||||
static double sqrt(const int& x) { return std::sqrt(static_cast<double>(x)); }
|
||||
static int abs(const int& x) { return std::abs(x); }
|
||||
static int abs2(const int& x) { return x*x; }
|
||||
static int random()
|
||||
{
|
||||
@ -83,8 +81,6 @@ template<> struct NumTraits<float>
|
||||
static float real(const float& x) { return x; }
|
||||
static float imag(const float& x) { EI_UNUSED(x); return 0; }
|
||||
static float conj(const float& x) { return x; }
|
||||
static float sqrt(const float& x) { return std::sqrt(x); }
|
||||
static float abs(const float& x) { return std::abs(x); }
|
||||
static float abs2(const float& x) { return x*x; }
|
||||
static float random()
|
||||
{
|
||||
@ -92,11 +88,11 @@ template<> struct NumTraits<float>
|
||||
}
|
||||
static bool isMuchSmallerThan(const float& a, const float& b, const float& prec = precision())
|
||||
{
|
||||
return abs(a) <= abs(b) * prec;
|
||||
return std::abs(a) <= std::abs(b) * prec;
|
||||
}
|
||||
static bool isApprox(const float& a, const float& b, const float& prec = precision())
|
||||
{
|
||||
return abs(a - b) <= std::min(abs(a), abs(b)) * prec;
|
||||
return std::abs(a - b) <= std::min(std::abs(a), std::abs(b)) * prec;
|
||||
}
|
||||
static bool isApproxOrLessThan(const float& a, const float& b, const float& prec = precision())
|
||||
{
|
||||
@ -117,8 +113,6 @@ template<> struct NumTraits<double>
|
||||
static double real(const double& x) { return x; }
|
||||
static double imag(const double& x) { EI_UNUSED(x); return 0; }
|
||||
static double conj(const double& x) { return x; }
|
||||
static double sqrt(const double& x) { return std::sqrt(x); }
|
||||
static double abs(const double& x) { return std::abs(x); }
|
||||
static double abs2(const double& x) { return x*x; }
|
||||
static double random()
|
||||
{
|
||||
@ -126,11 +120,11 @@ template<> struct NumTraits<double>
|
||||
}
|
||||
static bool isMuchSmallerThan(const double& a, const double& b, const double& prec = precision())
|
||||
{
|
||||
return abs(a) <= abs(b) * prec;
|
||||
return std::abs(a) <= std::abs(b) * prec;
|
||||
}
|
||||
static bool isApprox(const double& a, const double& b, const double& prec = precision())
|
||||
{
|
||||
return abs(a - b) <= std::min(abs(a), abs(b)) * prec;
|
||||
return std::abs(a - b) <= std::min(std::abs(a), std::abs(b)) * prec;
|
||||
}
|
||||
static bool isApproxOrLessThan(const double& a, const double& b, const double& prec = precision())
|
||||
{
|
||||
@ -152,12 +146,8 @@ template<typename _Real> struct NumTraits<std::complex<_Real> >
|
||||
static Real real(const Complex& x) { return std::real(x); }
|
||||
static Real imag(const Complex& x) { return std::imag(x); }
|
||||
static Complex conj(const Complex& x) { return std::conj(x); }
|
||||
static FloatingPoint sqrt(const Complex& x)
|
||||
{ return std::sqrt(static_cast<FloatingPoint>(x)); }
|
||||
static RealFloatingPoint abs(const Complex& x)
|
||||
{ return std::abs(static_cast<FloatingPoint>(x)); }
|
||||
static Real abs2(const Complex& x)
|
||||
{ return std::real(x) * std::real(x) + std::imag(x) * std::imag(x); }
|
||||
{ return std::norm(x); }
|
||||
static Complex random()
|
||||
{
|
||||
return Complex(NumTraits<Real>::random(), NumTraits<Real>::random());
|
||||
|
@ -145,14 +145,12 @@ template<typename Scalar, typename Derived> class Object
|
||||
Derived& operator*=(const int& other);
|
||||
Derived& operator*=(const float& other);
|
||||
Derived& operator*=(const double& other);
|
||||
Derived& operator*=(const std::complex<int>& other);
|
||||
Derived& operator*=(const std::complex<float>& other);
|
||||
Derived& operator*=(const std::complex<double>& other);
|
||||
|
||||
Derived& operator/=(const int& other);
|
||||
Derived& operator/=(const float& other);
|
||||
Derived& operator/=(const double& other);
|
||||
Derived& operator/=(const std::complex<int>& other);
|
||||
Derived& operator/=(const std::complex<float>& other);
|
||||
Derived& operator/=(const std::complex<double>& other);
|
||||
|
||||
|
@ -104,7 +104,6 @@ Object<Scalar, Derived>::operator/=(const OtherScalar &other) \
|
||||
EI_MAKE_SCALAR_OPS(int)
|
||||
EI_MAKE_SCALAR_OPS(float)
|
||||
EI_MAKE_SCALAR_OPS(double)
|
||||
EI_MAKE_SCALAR_OPS(std::complex<int>)
|
||||
EI_MAKE_SCALAR_OPS(std::complex<float>)
|
||||
EI_MAKE_SCALAR_OPS(std::complex<double>)
|
||||
|
||||
|
@ -75,7 +75,6 @@ template<typename MatrixType> void basicStuff(const MatrixType& m)
|
||||
void EigenTest::testBasicStuff()
|
||||
{
|
||||
basicStuff(Matrix<float, 1, 1>());
|
||||
basicStuff(Matrix<complex<int>, 2, 5>());
|
||||
basicStuff(Matrix<complex<double>, 4, 4>());
|
||||
basicStuff(MatrixXcf(3, 3));
|
||||
basicStuff(MatrixXi(8, 12));
|
||||
|
Loading…
Reference in New Issue
Block a user