2010-06-29 01:42:59 +08:00
|
|
|
#include <Eigen/Dense>
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
int main() {
|
2021-12-08 03:57:38 +08:00
|
|
|
Eigen::Array22f m;
|
2010-10-18 20:44:27 +08:00
|
|
|
m << 1, 2, 3, 4;
|
2021-12-08 03:57:38 +08:00
|
|
|
Eigen::Array44f a = Eigen::Array44f::Constant(0.6);
|
|
|
|
std::cout << "Here is the array a:\n" << a << "\n\n";
|
2010-10-18 20:44:27 +08:00
|
|
|
a.block<2, 2>(1, 1) = m;
|
2021-12-08 03:57:38 +08:00
|
|
|
std::cout << "Here is now a with m copied into its central 2x2 block:\n" << a << "\n\n";
|
2010-10-18 20:44:27 +08:00
|
|
|
a.block(0, 0, 2, 3) = a.block(2, 1, 2, 3);
|
2021-12-08 03:57:38 +08:00
|
|
|
std::cout << "Here is now a with bottom-right 2x3 block copied into top-left 2x3 block:\n" << a << "\n\n";
|
2010-06-29 01:42:59 +08:00
|
|
|
}
|