1 #include <Eigen/Dense>
2 #include <iostream>
3
4 using namespace std;
5 using namespace Eigen;
6
main()7 int main()
8 {
9 Array22f m;
10 m << 1,2,
11 3,4;
12 Array44f a = Array44f::Constant(0.6);
13 cout << "Here is the array a:" << endl << a << endl << endl;
14 a.block<2,2>(1,1) = m;
15 cout << "Here is now a with m copied into its central 2x2 block:" << endl << a << endl << endl;
16 a.block(0,0,2,3) = a.block(2,1,2,3);
17 cout << "Here is now a with bottom-right 2x3 block copied into top-left 2x2 block:" << endl << a << endl << endl;
18 }
19