Registered Member
|
Hi,
i' ve got a problem with this code, can somebody help me: possibility1:
possibility2:
.. where vec is a VectorXd with size 10. Why neither possibility1 nor possibilty2 works? With the mat.row( 10) i want to place the values of transposed Vector (or Vector). After that matrix row with index 10 is Zero and not equal the values of vector vec.
Last edited by bjacob on Sat Jan 03, 2009 1:27 pm, edited 1 time in total.
Xtremecpp, proud to be a member of KDE forums since 2008-Dec.
|
Moderator
|
Hi,
note that the indices start from 0, therefore the index of the 10th and last row is 9, not 10, so if you want a 10x10 matrix with the last row equal to vec, write:
FYI, in your example, you can also do:
one more thing, perhaps you misunderstood the meaning of "dynamic-size matrix". Here "dynamic" means the size is known at runtime and the matrix can be explicitly resized using the resize() function. However, there is no implicit resizing, and in particular you cannot dynamically add a new row without creating a new, temporary, matrix. If you really need to do that, then here is an example which appends vec to a 10x10 matrix:
Here, I used set() instead of operator=() such that mat is automatically resized, and operator<< and operator, to append mat and vec to a new, temporary matrix which is then copied to mat, and yes, in that example, there is one useless copy (unless the compiler is smart enough to remove it)
Last edited by ggael on Thu Jan 01, 2009 5:12 pm, edited 1 time in total.
|
Registered Member
|
Thanks,
for your help. ... now i have another Problem:
problem is that no matrix element has the value of variable min. Whats the problem?
Xtremecpp, proud to be a member of KDE forums since 2008-Dec.
|
Moderator
|
hm.. I don't get it, have you tried with only:
? Also, have you tried to print out test:
? and can you show us the implementation of function ? |
Registered Member
|
That sounds.... impossible. Can you double check your code? Try to isolate a small testcase and post it here? After "min = test.minCoeff( row, col);" returns, min really should be the smallest coefficient in the matrix test.
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
|
Hi,
sorry the problem was my fault. When i am searching for the minimum in the matrix i take "1,23448" but in the matrix the comma is represented by decimal point so i can't found the minimum. Thanks
Xtremecpp, proud to be a member of KDE forums since 2008-Dec.
|
Registered Member
|
Ah, ok. Just FYI, when you do stream << matrix to print your matrix, it will honor the locale settings of your stream. So you can get comma-as-decimal-point by setting another locale for your stream with imbue() or you can pass a global locale setting to your app by setting the LANG variable (at least on unix)
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered users: Bing [Bot], Evergrowing, Google [Bot], rblackwell