mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Clang-format tests, examples, libraries, benchmarks, etc.
This commit is contained in:
committed by
Rasmus Munk Larsen
parent
3252ecc7a4
commit
46e9cdb7fe
@@ -1,28 +1,23 @@
|
||||
#include <Eigen/Core>
|
||||
#include <iostream>
|
||||
|
||||
class MyVectorType : public Eigen::VectorXd
|
||||
{
|
||||
public:
|
||||
MyVectorType(void):Eigen::VectorXd() {}
|
||||
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 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;
|
||||
}
|
||||
// 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()
|
||||
{
|
||||
int main() {
|
||||
MyVectorType v = MyVectorType::Ones(4);
|
||||
v(2) += 10;
|
||||
v = 2 * v;
|
||||
|
||||
Reference in New Issue
Block a user