tut_matrix_coefficient_accessors.cpp 343 B

123456789101112131415161718
  1. #include <iostream>
  2. #include <Eigen/Dense>
  3. using namespace Eigen;
  4. int main()
  5. {
  6. MatrixXd m(2,2);
  7. m(0,0) = 3;
  8. m(1,0) = 2.5;
  9. m(0,1) = -1;
  10. m(1,1) = m(1,0) + m(0,1);
  11. std::cout << "Here is the matrix m:\n" << m << std::endl;
  12. VectorXd v(2);
  13. v(0) = 4;
  14. v(1) = v(0) - 1;
  15. std::cout << "Here is the vector v:\n" << v << std::endl;
  16. }