Registered Member
|
I would to check if rows contain NaN/Inf, if they do, ommit these rows. What i did in matlab is as follows:
ok = all(isfinite(data), 2); data = data(ok, : ) Is there a quick way to do similar things in Eigen? Thanks. |
Registered Member
|
There are two ways that you could do this, either you wrap isfinite() as a functor (you can directly use std::ptr_fun) and use Eigen's unaryExpr() method with it,
http://eigen.tuxfamily.org/dox-devel/cl ... 9a4c5a9bc4 Or you can implement your function right away on whole matrices from scratch:
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered Member
|
When I try that code snippet I get a compile error. Is this Eigen3?
|
Moderator
|
The following should really work (it was missing a .all()):
return ((x - x).array() == (x - x).array()).all(); |
Registered Member
|
Now it works Not any more...
Interestingly, it now works also without the .all() but the only thing I changed was uncommenting that code part again. Strange. Thank you very much anyway! EDIT: See following posts.
Last edited by vernal on Wed May 18, 2011 3:32 pm, edited 1 time in total.
|
Registered Member
|
I have to correct myself: It works in my MSVC Release configuration but not in the Debug configuration. I'll try to find out, what is going on.
EDIT: It seems to have to do with Qt. It tries to use a Qt operator- but I don't know why. Here is the error: EDITEDIT: It doesn't have to do with Qt. See below.
And here is the code:
The code compiles fine in another project (Debug and Release) or in the Release configuration of the affected project. How can I use Eigen's operator- directly? With Eigen::DenseBase<Derived> I can only find operator-=
Last edited by vernal on Thu May 19, 2011 11:20 am, edited 1 time in total.
|
Registered Member
|
I thought I had found the reason, but it worked only because the function call was inside an assert statement that is not evaluated in Release mode.
So it doesn't work neither in Debug nor in Release mode. |
Registered Member
|
I'm continuing my monologue if no one has objections
The mere function definition in another project worked fine (that's what I tried and posted in an earlier post), however using the function forces template instantiation and that's where it fails. In another project without any Qt involved a test with a Matrix4d shows that it tries to use the operator- of iterator. Why is the Eigen::DenseBase::operator- (or whatever is needed here) not found?
Conclusion: It has nothing to do with Qt but seems to be indeed Eigen related. |
Moderator
|
I'm not sure to follow you, could you show a simple self contained example that trigger the issue.
|
Registered Member
|
I'm sorry for the confusion. I posted my findings as they came up. To me this example fails:
With the error
for the first function and
for the second which is basically the same. Am I doing something wrong here? |
Moderator
|
correct versions:
|
Registered Member
|
Thank you! It was only a DenseBase vs. MatrixBase issue. Interesting.
Works also for me here. Cheers vernal |
Registered users: Bing [Bot], Google [Bot], q.ignora, watchstar