1 2 3 4 5 6 7 8 9 10 11 12 13 | mxd::t m(4,4); m << 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16; co("Block in the middle"); co(m.block<2,2>(1,1) , " block : "); for(z::t i(1) ; i <= 3; ++i ){ co(i,"block of size :"); co(m.block(0,0,i,i)); } | cs |
1 by 1 to 3 by 3 block
result :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | Block in the middle block : = 6 7 10 11 block of size : = 1 output = 1 block of size : = 2 output = 1 2 5 6 block of size : = 3 output = 1 2 3 5 6 7 9 10 11 | cs |
block replacing :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | mxd::t m(4,4); m << 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16; m2d::t m2; m2 << 1, 1, 1, 1; m.block(0,0,2,2) = m2; co(m, "block replaced.!"); | cs |
result
1 2 3 4 5 6 | block replaced.! = 1 1 3 4 1 1 7 8 9 10 11 12 13 14 15 16 | cs |
'Linear Algebra' 카테고리의 다른 글
[Eigen] 아이겐을 사용한 선형대수 복습 1일차 (0) | 2019.05.21 |
---|---|
[Eigen] extracting a vector from the vector space (0) | 2019.05.21 |
[Eigen] Linear algebra and decompositions (0) | 2019.05.21 |
[C++] Eigen 사용법 2.초기화 (0) | 2019.05.21 |
[C++] Eigen 사용법 1.메뉴얼 (0) | 2019.02.04 |