Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. class A {
  2. public:
  3. array<double,3> xa;
  4. Map<Matrix<double,3,1>> x;
  5. A() : x(xa.data(),xa.size()) {}
  6. };
  7.  
  8. A a;
  9. a.xa[0] = 0.12;
  10. cout << a.x ;
  11.  
  12. #include <Eigen/Core>
  13. #include <array>
  14. #include <iostream>
  15.  
  16. using namespace std;
  17. using namespace Eigen;
  18.  
  19. class A {
  20. public:
  21. array<double,3> xa;
  22. Map<Matrix<double,3,1>> x;
  23. A() : x(xa.data(),xa.size()) {}
  24. };
  25.  
  26. int main()
  27. {
  28. A a;
  29. a.xa[0] = 0.12;
  30. cout << a.x ;
  31. }
  32.  
  33. g++ test.cpp -std=c++0x -o test -I/usr/include/eigen3
  34.  
  35. [/tmp]% ./test
  36. 0.12
  37. 2.07717e-317
  38. 0%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement