Registered Member
|
Hello.
I really stuck with the following problem (least squares). First I create 2 big matrices:
Then I fill them by data:
Then I trying to calculate least squares:
I cannot figure out why I can produce 3×3 matrix by doing x.cast<double>() * x.cast<double>().transpose(), but cannot produce 3×2 matrix by doing x.cast<double>() * f.cast<double>().transpose(). I am sure that I can substitute for-loops doing multiplication instead of calling eigen multiplication, and program will work. P.S. The type conversions are necessary to me. I need to find matrix that maps 3-component integer vectors into 2-components float vectors. The values of matrix x * x.transpose() will not fit into integer, so I want to use double to do summation. |
Registered Member
|
If I use N = 1000 insted of N = 10000 then I get correct result:
Gives me
But I need to use millions of datapoints. |
Moderator
|
sorry but I cannot reproduce.
Can you give us information about your system and compiler. here is a complete example:
|
Registered Member
|
Interestingly that your code works fine, while my code crashes. The only difference of my code from yours is presence of templated function (I do not know why this matters):
I use Visual Studio 2010 Express (crash on both Debug and Release default settings), Windows Vista (32-bit). |
Registered Member
|
Sorry! Now I see the reason for the error!
I should have used Eigen::Dynamic instead of "N" as the last template argument! |
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]