mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-20 08:39:37 +08:00
31 lines
479 B
C++
31 lines
479 B
C++
#include "../src/Core.h"
|
|
|
|
USING_EIGEN_DATA_TYPES
|
|
|
|
using namespace std;
|
|
|
|
template<typename Scalar, typename Derived>
|
|
void foo(const Eigen::Object<Scalar, Derived>& m)
|
|
{
|
|
cout << "Here's m:" << endl << m << endl;
|
|
}
|
|
|
|
template<typename Scalar, typename Derived>
|
|
Eigen::ScalarMultiple<Derived>
|
|
twice(const Eigen::Object<Scalar, Derived>& m)
|
|
{
|
|
return 2 * m;
|
|
}
|
|
|
|
int main(int, char**)
|
|
{
|
|
Matrix2d m;
|
|
m(0,0)= 1;
|
|
m(1,0)= 2;
|
|
m(0,1)= 3;
|
|
m(1,1)= 4;
|
|
foo(m);
|
|
foo(twice(m));
|
|
return 0;
|
|
}
|