aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Rasmus Munk Larsen <rmlarsen@google.com>2021-04-02 22:06:27 +0000
committerGravatar Rasmus Munk Larsen <rmlarsen@google.com>2021-04-02 22:06:27 +0000
commit3ddc0974ce42d7cdd9161dda2a9558d6800d12c8 (patch)
treed7f2c3352c9d7fdf6fcad0cf240206e9ec5033d1
parentc24bee6120d40987b15df0cbdaaa60e3de877e01 (diff)
Fix two bugs in commit
-rw-r--r--Eigen/src/SVD/SVDBase.h5
-rw-r--r--test/AnnoyingScalar.h21
-rw-r--r--test/geo_quaternion.cpp2
3 files changed, 21 insertions, 7 deletions
diff --git a/Eigen/src/SVD/SVDBase.h b/Eigen/src/SVD/SVDBase.h
index 13c8394ae..bc7ab88b4 100644
--- a/Eigen/src/SVD/SVDBase.h
+++ b/Eigen/src/SVD/SVDBase.h
@@ -51,6 +51,9 @@ template<typename Derived> struct traits<SVDBase<Derived> >
* smaller value among \a n and \a p, there are only \a m singular vectors; the remaining columns of \a U and \a V do not correspond to actual
* singular vectors. Asking for \em thin \a U or \a V means asking for only their \a m first columns to be formed. So \a U is then a n-by-m matrix,
* and \a V is then a p-by-m matrix. Notice that thin \a U and \a V are all you need for (least squares) solving.
+ *
+ * The status of the computation can be retrived using the \a info() method. Unless \a info() returns \a Success, the results should be not
+ * considered well defined.
*
* If the input matrix has inf or nan coefficients, the result of the computation is undefined, and \a info() will return \a InvalidInput, but the computation is guaranteed to
* terminate in finite (and reasonable) time.
@@ -253,8 +256,6 @@ protected:
void _check_compute_assertions() const {
eigen_assert(m_isInitialized && "SVD is not initialized.");
- eigen_assert(m_info != InvalidInput && "SVD failed due to invalid input.");
- eigen_assert(m_info != NumericalIssue && "SVD failed due to invalid input.");
}
template<bool Transpose_, typename Rhs>
diff --git a/test/AnnoyingScalar.h b/test/AnnoyingScalar.h
index 889e6cc86..9f8d52796 100644
--- a/test/AnnoyingScalar.h
+++ b/test/AnnoyingScalar.h
@@ -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>(); }
diff --git a/test/geo_quaternion.cpp b/test/geo_quaternion.cpp
index 6cfdb6f10..c4a3162b3 100644
--- a/test/geo_quaternion.cpp
+++ b/test/geo_quaternion.cpp
@@ -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>() ));
}
}