This forum has been archived. All content is frozen. Please use KDE Discuss instead.

TriangularView with custom scalar types crashes

Tags: matrix, custom type matrix, custom type matrix, custom type
(comma "," separated)
stefanschupp
Registered Member
Posts
2
Karma
0
When introducing a custom scalar type "number" via extension of the typetraits

namespace Eigen
{
template<> struct NumTraits<number>
{
enum
{
IsComplex = 0,
IsInteger = 0,
ReadCost = 1,
AddCost = 1,
MulCost = 1,
IsSigned = 1,
RequireInitialization = 1 // not sure - this indicates that the constructor has to be called
};

typedef number Real;
typedef number NonInteger;
typedef number Nested;

static inline Real epsilon() { return Real(0); }
static inline Real dummy_precision()
{
// make sure to override this for floating-point types
return Real(0);
}
//static inline number highest() { return number::maxVal(); }
//static inline number lowest() { return number::minVal(); }


};
}

it turns out, that the triangularView does not work properly. During compilation I get:

error: expected expression
Matrix5x3 u = lu.matrixLU().triangularView<Eigen::Upper>();
^
Note: This is part of the example for full pivor LU decomposition. The only thing changed is the scalar type, which is set to the custom type. Did I forget something in the customization of the scalar types, which causes this error?

Best regards,
Stefan
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
please, paste the complete error message.
stefanschupp
Registered Member
Posts
2
Karma
0
This is the complete error message, I do not get more:

[...]/Polytopes/HPolytope/HPolytope.tpp:136:66: error: expected expression
Matrix5x3 u = lu.matrixLU().triangularView<Eigen::Upper>();
.....................................................................................................^
1 error generated.
make[3]: *** [examples/CMakeFiles/example_vertexEnumeration.dir/example_vertexEnumeration.cpp.o] Error 1

When replacing my custom type with a double, the error does not occur. Thought I missed something in the Typetraits Definition.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
hm, you might have a non ascii character hidden somewhere in the source code.


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]