Registered Member
|
Hi,
this is a follow-up from my previous post. I want to implement (scalar - matrix operation), like 1. - myMatrix. I use the Matrix API in my code, and I would like to add this operation properly in EigenMatrixBaseAddon by using a CwiseUnaryOp. Here is the code I added in EigenMatrixBaseAddon:
Now, here is one of my unit test:
Where UniformStatistic::sample() simply samples a decimal number between the bounds using an uniform distribution. For a given t, the output looks like:
One can see that there is a discrepancy only on the first item. I have upgraded Eigen to version 3.2.5. If I increase nbInd, I get more errors. For example, with nbInd = 100 instead of 10, I get the first four coefficients wrong. I mentionned a possible bug because this implementation is very similar to other I have done, and I do not understand why only the first coefficients would be wrong. Note that when the discrepancy occur, the value of the corresponding coefficient in scalar - vector is equal to scalar, so it looks like the first coefficients of vector are considered equal to 0. Regards |
Registered Member
|
My mistake, here is the working implementation:
|
Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]