Registered Member
|
I have to perform matrix production for really a lot of times in some loops. (parallelized by openmp)
I found that this assignment sometimes cause problems A = G * A , where e.g. G(10,10), A(10,100) While A_temp= G * A; A=A_temp is always safe, is there any explanation? thanks!
Last edited by lorniper on Wed Apr 30, 2014 2:02 pm, edited 1 time in total.
|
Registered Member
|
The dimension of your G*A product is 10x100, and you're trying to store the result in A which is 100*100. The dimension mismatch is likely what gets your in trouble. Try something like this instead: A.block(10, 100) = G * A;
|
Registered Member
|
sorry, I made a typo, it should be A = G * A , where e.g. G(10,10), A(10,100),
then is it always reliable for this overwritten operation? casuse i really got some wierd results if no temp has been used. thanks |
Moderator
|
That's strange because by default matrix products evaluate in a temporary. My guess is that there is a memory issue somewhere else. Valgrind my help you.
|
Moderator
|
I see you're using openmp, don't miss this page: http://eigen.tuxfamily.org/dox/TopicMultiThreading.html
|
Registered users: Baidu [Spider], Bing [Bot], Google [Bot], rblackwell