mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-06 17:17:14 +08:00
Move eigen to third party (#282)
* remove useless statement * Add eigen to third_party dir * remove reducdant lines
This commit is contained in:
27
third_party/eigen/doc/examples/CustomizingEigen_Inheritance.cpp
vendored
Normal file
27
third_party/eigen/doc/examples/CustomizingEigen_Inheritance.cpp
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <Eigen/Core>
|
||||
#include <iostream>
|
||||
|
||||
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;
|
||||
}
|
Reference in New Issue
Block a user