This forum has been archived. All content is frozen. Please use KDE Discuss instead.

"Best way for partitioning a dynamic sized matrix"

Tags: None
(comma "," separated)
poqovic
Registered Member
Posts
9
Karma
0
OS
Any suggesitions?

the code below seems a bit messy,

Code: Select all
Eigen::MatrixXd mtr=Eigen::MatrixXd::Zero(10,10);
Eigen::Block<Eigen::MatrixXd> blck=mtr.block(1,1,2,2);
Eigen::Block<Eigen::Block<Eigen::MatrixXd>> blk=blck.block(1,1,1,1);


it seems there is not only one interface for Matrix and sub matrices, am i wrong?

Also mapping to directly data seems does not work, i think alignement problems, the "stride thing".

Code: Select all
Eigen::Map<Eigen::MatrixXd> mp(mtr.data(),5,5);
mp(5,5)=-123;


All i want to do is like this

Code: Select all
Eigen::MatrixXd mtr;

Eigen::MatrixXd sub;

Eigen::MatrixXd sub_sub;

MatrixXd sub = mtr.sub(row,col,rowcount,colcount);

Eigen::MatrixXd sub_sub = sub.sub(row,col,rowcount,colcount);



After some update on sub_sub, there must be concurrent updates on sub and mtr, do i want so much?

only pointer change must be done.

Is there a way throught what i want?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
if you can use C++11 features, then the 'auto' keywords might help:

auto sub = mtr.block(...);
auto sub_sub = sub.block(...);

For many reasons it is not possible to add what you're looking for into Matrix, but we are in the process of adding a new class for that and more.


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]