Re: [eigen] Eigen2: Assert failure in QR |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Eigen2: Assert failure in QR
- From: Keir Mierle <mierle@xxxxxxxxx>
- Date: Thu, 15 Jul 2010 13:35:54 -0700
- Cc: Nick Lewycky <nlewycky@xxxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=VLG+SAhriyG+CO+pzKfCbZx09awhav+Ld9XxPjBrnVY=; b=vx7uVC8BfCH0N99nBKLAgSNaebumUeXY0WLNY+0sJHqsedAgYZY4Ks8r2qpSCkdV6j /UbPa2+m4aFGbRKlN1mET3Mr1EsenQwk3UhQGzm+o4r0T38L0XO3Ljo5WOLEezj6o5Ni klRVEXd2WcAQAWJy8Q+4350w5I588BSAR4YaE=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=wyreAX37cmgfzGcUrcRRah33NQT7PBCSZHenu/Wm6OVhj4TGV2cvVVYkt4bXCWS6J9 8jrzglHScLi/+QqFOkwiUY/JEcvm723C+HMw5W1cjX+rAsadl0ZGUqwUwZ5bGvCIGPs9 Ia411d1OlqRgu3Q9rCsHS+eYI/zwl+3LNzKSY=
This patch is due to Nick Lewycky.
Fix C++ conformance problems in stable eigen; discovered by clang.
* the 'template' keyword is required when the type is dependent on a
template argument. With 'template' we treat the next identifier as
a template method instead of a member variable and less-than
operator.
* ei_cache_friendly_product was never actually static. Remove the
bogus 'static' keyword. (Adding it properly caused link errors.)
* sink the definition of template function ei_hypot after the
declarations of the functions it tries to call.
Clang warns on default template argument
int StorageOrder = (unsigned)-1
so cast the whole RHS as int which appears to have been the intent.
Keir
I have another set of patches for Clang compatibility we should add before 2.0.15.
Give me a few minutes to send it in.
Keir
On Thu, Jul 15, 2010 at 11:13 AM, Benoit Jacob
<jacob.benoit.1@xxxxxxxxx> wrote:
Time to release 2.0.15 ? There's been one other important fix.
As soon as someone confirms gcc 3.3 and msvc, i'm OK to release.
The flurry of 2.0 fixes in the past 2 months is rather impressive, i
guess it means that the number of users increased...
Benoit
2010/7/15 Gael Guennebaud <gael.guennebaud@xxxxxxxxx>:
> oh, we probably fixed the bug at the very same time ;)
>
> indeed, it scary to have such a bug, fortunately unit test in 3.0 are
> much better ;)
>
> gael
>
> On Thu, Jul 15, 2010 at 7:58 PM, Keir Mierle <
mierle@xxxxxxxxx> wrote:
>> Fix attached. How did this ever work before?
>> Keir
>>
>> On Thu, Jul 15, 2010 at 9:55 AM, Sameer Agarwal <
sameeragarwal@xxxxxxxxxx>
>> wrote:
>>>
>>> Hi Guys,
>>> Maps and QR in Eigen2 triggers an assert error, depending on whether
>>> -DNDEBUG is used or not.
>>>
>>> eigen# g++ qr_test.cc -o qr1
>>>
>>> eigen# ./qr1
>>> Assertion failed: (rows == this->rows()), function resize, file
>>> Eigen/src/Core/Map.h, line 84.
>>> Abort trap
>>>
>>> eigen# g++ qr_test.cc -DNDEBUG -o qr2
>>> eigen# ./qr2
>>>
>>> This is against Eigen 2.0.14.
>>> Sameer
>>
>>
>
>
>
diff --git a/eigen/Eigen/src/Array/BooleanRedux.h b/eigen/Eigen/src/Array/BooleanRedux.h
index 4e82183..cd59eb0 100644
--- a/eigen/Eigen/src/Array/BooleanRedux.h
+++ b/eigen/Eigen/src/Array/BooleanRedux.h
@@ -139,7 +139,7 @@ inline bool MatrixBase<Derived>::any() const
template<typename Derived>
inline int MatrixBase<Derived>::count() const
{
- return this->cast<bool>().cast<int>().sum();
+ return this->cast<bool>().template cast<int>().sum();
}
#endif // EIGEN_ALLANDANY_H
diff --git a/eigen/Eigen/src/Core/CoreInstantiations.cpp b/eigen/Eigen/src/Core/CoreInstantiations.cpp
index 56a9448..e72b705 100644
--- a/eigen/Eigen/src/Core/CoreInstantiations.cpp
+++ b/eigen/Eigen/src/Core/CoreInstantiations.cpp
@@ -32,7 +32,7 @@ namespace Eigen
{
#define EIGEN_INSTANTIATE_PRODUCT(TYPE) \
-template static void ei_cache_friendly_product<TYPE>( \
+template void ei_cache_friendly_product<TYPE>( \
int _rows, int _cols, int depth, \
bool _lhsRowMajor, const TYPE* _lhs, int _lhsStride, \
bool _rhsRowMajor, const TYPE* _rhs, int _rhsStride, \
diff --git a/eigen/Eigen/src/Core/MathFunctions.h b/eigen/Eigen/src/Core/MathFunctions.h
index f2f2a1b..35be925 100644
--- a/eigen/Eigen/src/Core/MathFunctions.h
+++ b/eigen/Eigen/src/Core/MathFunctions.h
@@ -35,16 +35,6 @@ template<typename T> inline T ei_random_amplitude()
else return static_cast<T>(10);
}
-template<typename T> inline T ei_hypot(T x, T y)
-{
- T _x = ei_abs(x);
- T _y = ei_abs(y);
- T p = std::max(_x, _y);
- T q = std::min(_x, _y);
- T qp = q/p;
- return p * ei_sqrt(T(1) + qp*qp);
-}
-
/**************
*** int ***
**************/
@@ -292,4 +282,16 @@ inline bool ei_isApproxOrLessThan(long double a, long double b, long double prec
return a <= b || ei_isApprox(a, b, prec);
}
+// Templates that make use of all of the above
+
+template<typename T> inline T ei_hypot(T x, T y)
+{
+ T _x = ei_abs(x);
+ T _y = ei_abs(y);
+ T p = std::max(_x, _y);
+ T q = std::min(_x, _y);
+ T qp = q/p;
+ return p * ei_sqrt(T(1) + qp*qp);
+}
+
#endif // EIGEN_MATHFUNCTIONS_H
diff --git a/eigen/Eigen/src/Core/SolveTriangular.h b/eigen/Eigen/src/Core/SolveTriangular.h
index 12fb0e1..4934ef3 100644
--- a/eigen/Eigen/src/Core/SolveTriangular.h
+++ b/eigen/Eigen/src/Core/SolveTriangular.h
@@ -35,7 +35,7 @@ template<typename Lhs, typename Rhs,
? UpperTriangular
: -1,
int StorageOrder = ei_is_part<Lhs>::value ? -1 // this is to solve ambiguous specializations
- : int(Lhs::Flags) & (RowMajorBit|SparseBit)
+ : int(Lhs::Flags & (RowMajorBit|SparseBit))
>
struct ei_solve_triangular_selector;