You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
801 B

  1. #include <StormEigen/Core>
  2. #include <iostream>
  3. class MyVectorType : public StormEigen::VectorXd
  4. {
  5. public:
  6. MyVectorType(void):StormEigen::VectorXd() {}
  7. // This constructor allows you to construct MyVectorType from Eigen expressions
  8. template<typename OtherDerived>
  9. MyVectorType(const StormEigen::MatrixBase<OtherDerived>& other)
  10. : StormEigen::VectorXd(other)
  11. { }
  12. // This method allows you to assign Eigen expressions to MyVectorType
  13. template<typename OtherDerived>
  14. MyVectorType& operator=(const StormEigen::MatrixBase <OtherDerived>& other)
  15. {
  16. this->StormEigen::VectorXd::operator=(other);
  17. return *this;
  18. }
  19. };
  20. int main()
  21. {
  22. MyVectorType v = MyVectorType::Ones(4);
  23. v(2) += 10;
  24. v = 2 * v;
  25. std::cout << v.transpose() << std::endl;
  26. }