mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Fix two bugs in commit
This commit is contained in:
@@ -76,20 +76,20 @@ class AnnoyingScalar
|
||||
|
||||
AnnoyingScalar operator/(const AnnoyingScalar& other) const
|
||||
{ return AnnoyingScalar((*v)/(*other.v)); }
|
||||
|
||||
|
||||
AnnoyingScalar& operator+=(const AnnoyingScalar& other) { *v += *other.v; return *this; }
|
||||
AnnoyingScalar& operator-=(const AnnoyingScalar& other) { *v -= *other.v; return *this; }
|
||||
AnnoyingScalar& operator*=(const AnnoyingScalar& other) { *v *= *other.v; return *this; }
|
||||
AnnoyingScalar& operator/=(const AnnoyingScalar& other) { *v /= *other.v; return *this; }
|
||||
AnnoyingScalar& operator= (const AnnoyingScalar& other) { *v = *other.v; return *this; }
|
||||
|
||||
|
||||
bool operator==(const AnnoyingScalar& other) const { return *v == *other.v; }
|
||||
bool operator!=(const AnnoyingScalar& other) const { return *v != *other.v; }
|
||||
bool operator<=(const AnnoyingScalar& other) const { return *v <= *other.v; }
|
||||
bool operator< (const AnnoyingScalar& other) const { return *v < *other.v; }
|
||||
bool operator>=(const AnnoyingScalar& other) const { return *v >= *other.v; }
|
||||
bool operator> (const AnnoyingScalar& other) const { return *v > *other.v; }
|
||||
|
||||
|
||||
float* v;
|
||||
float data;
|
||||
static int instances;
|
||||
@@ -136,12 +136,23 @@ struct NumTraits<AnnoyingScalar> : NumTraits<float>
|
||||
|
||||
template<> inline AnnoyingScalar test_precision<AnnoyingScalar>() { return test_precision<float>(); }
|
||||
|
||||
namespace numext {
|
||||
template<>
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
|
||||
bool (isfinite)(const AnnoyingScalar& x) {
|
||||
return (numext::isfinite)(*x.v);
|
||||
}
|
||||
}
|
||||
|
||||
namespace internal {
|
||||
template<> AnnoyingScalar pcmp_eq(const AnnoyingScalar& x, const AnnoyingScalar& y)
|
||||
{ return AnnoyingScalar(pcmp_eq(*x.v, *y.v)); }
|
||||
template<> AnnoyingScalar pselect(const AnnoyingScalar& cond, const AnnoyingScalar& x, const AnnoyingScalar& y)
|
||||
{ return numext::equal_strict(*cond.v, 0.f) ? y : x; }
|
||||
template<> double cast(const AnnoyingScalar& x) { return double(*x.v); }
|
||||
template<> float cast(const AnnoyingScalar& x) { return *x.v; }
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Eigen
|
||||
|
||||
AnnoyingScalar get_test_precision(const AnnoyingScalar&)
|
||||
{ return Eigen::test_precision<AnnoyingScalar>(); }
|
||||
|
||||
@@ -332,7 +332,9 @@ EIGEN_DECLARE_TEST(geo_quaternion)
|
||||
CALL_SUBTEST_2(( quaternionAlignment<double>() ));
|
||||
CALL_SUBTEST_2( mapQuaternion<double>() );
|
||||
|
||||
#ifndef EIGEN_TEST_ANNOYING_SCALAR_DONT_THROW
|
||||
AnnoyingScalar::dont_throw = true;
|
||||
#endif
|
||||
CALL_SUBTEST_3(( quaternion<AnnoyingScalar,AutoAlign>() ));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user