Download include/eigen/doc/examples/CustomizingEigen_Inheritance.cpp from adfa5456/FastRobustICP: direct link, hf CLI and curl.
- Browser
- Download file 766 Bytes
-
https://huggingface.co/datasets/adfa5456/FastRobustICP/resolve/main/include/eigen/doc/examples/CustomizingEigen_Inheritance.cpp
- Command line
-
hf download hf://datasets/adfa5456/FastRobustICP/include/eigen/doc/examples/CustomizingEigen_Inheritance.cpp
-
curl -L -o CustomizingEigen_Inheritance.cpp https://huggingface.co/datasets/adfa5456/FastRobustICP/resolve/main/include/eigen/doc/examples/CustomizingEigen_Inheritance.cpp
766 Bytes
| class MyVectorType : public Eigen::VectorXd | |
| { | |
| public: | |
| MyVectorType(void):Eigen::VectorXd() {} | |
| // This constructor allows you to construct MyVectorType from Eigen expressions | |
| template<typename OtherDerived> | |
| MyVectorType(const Eigen::MatrixBase<OtherDerived>& other) | |
| : Eigen::VectorXd(other) | |
| { } | |
| // This method allows you to assign Eigen expressions to MyVectorType | |
| template<typename OtherDerived> | |
| MyVectorType& operator=(const Eigen::MatrixBase <OtherDerived>& other) | |
| { | |
| this->Eigen::VectorXd::operator=(other); | |
| return *this; | |
| } | |
| }; | |
| int main() | |
| { | |
| MyVectorType v = MyVectorType::Ones(4); | |
| v(2) += 10; | |
| v = 2 * v; | |
| std::cout << v.transpose() << std::endl; | |
| } | |