Registered Member
|
Hi!
I have got two matrice in the form : int x,y,z; (x=..,y=..,z=..) MatrixXd A(x,z) (1,2;5,6;7,8;9,10;......) MatrixXd B(y,z) (11,1;3,14;11,6;9,0;......) and i like to combine them to 1 matrix : MatrixXd AB(x+y,z) (1,2;5,6;7,8;9,10;......;11,1;3,14;11,6;9,0;......) what is the fastes way? I don't wanna make a new Matrix and copy every single value Thanks for helping, sorry for my english Greetings |
Registered Member
|
The easiest way is to use the so-called comma-initializer, for example, "combinedMatrix << matrix1, matrix2;"
See http://eigen.tuxfamily.org/dox-devel/Tu ... ation.html for more details. |
Registered Member
|
thank you this is exactly that what I was looking for!
But is it possible to vary the Number of matrices? if i have an array of matrices like vector<MatrixXd> test; and int o = .. (=numer of combinated matrices) |
Registered Member
|
No, this is not possible with a variable number of matrices. In that case, you best bet is probably to copy the matrices as blocks. For instance (not tested):
The member function .middleCols(c,n) selects n columns from the matrix starting at column c; see http://eigen.tuxfamily.org/dox/classEig ... 76d363d5d1 . |
Registered Member
|
i never had understand iterator's! this is my solution.
Thank you for your help!
Greetings Ajax! |
Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]