Tutorial_BlockOperations_vector.cpp 348 B

1234567891011121314
  1. #include <Eigen/Dense>
  2. #include <iostream>
  3. using namespace std;
  4. int main()
  5. {
  6. Eigen::ArrayXf v(6);
  7. v << 1, 2, 3, 4, 5, 6;
  8. cout << "v.head(3) =" << endl << v.head(3) << endl << endl;
  9. cout << "v.tail<3>() = " << endl << v.tail<3>() << endl << endl;
  10. v.segment(1,4) *= 2;
  11. cout << "after 'v.segment(1,4) *= 2', v =" << endl << v << endl;
  12. }