1 const int size = 6; 2 MatrixXd mat1(size, size); 3 mat1.topLeftCorner(size/2, size/2) = MatrixXd::Zero(size/2, size/2); 4 mat1.topRightCorner(size/2, size/2) = MatrixXd::Identity(size/2, size/2); 5 mat1.bottomLeftCorner(size/2, size/2) = MatrixXd::Identity(size/2, size/2); 6 mat1.bottomRightCorner(size/2, size/2) = MatrixXd::Zero(size/2, size/2); 7 std::cout << mat1 << std::endl << std::endl; 8 9 MatrixXd mat2(size, size); 10 mat2.topLeftCorner(size/2, size/2).setZero(); 11 mat2.topRightCorner(size/2, size/2).setIdentity(); 12 mat2.bottomLeftCorner(size/2, size/2).setIdentity(); 13 mat2.bottomRightCorner(size/2, size/2).setZero(); 14 std::cout << mat2 << std::endl << std::endl; 15 16 MatrixXd mat3(size, size); 17 mat3 << MatrixXd::Zero(size/2, size/2), MatrixXd::Identity(size/2, size/2), 18 MatrixXd::Identity(size/2, size/2), MatrixXd::Zero(size/2, size/2); 19 std::cout << mat3 << std::endl; 20 21