Tutorial_BlockOperations_colrow.cpp 390 B

1234567891011121314151617
  1. #include <Eigen/Dense>
  2. #include <iostream>
  3. using namespace std;
  4. int main()
  5. {
  6. Eigen::MatrixXf m(3,3);
  7. m << 1,2,3,
  8. 4,5,6,
  9. 7,8,9;
  10. cout << "Here is the matrix m:" << endl << m << endl;
  11. cout << "2nd Row: " << m.row(1) << endl;
  12. m.col(2) += 3 * m.col(0);
  13. cout << "After adding 3 times the first column into the third column, the matrix m is:\n";
  14. cout << m << endl;
  15. }