mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-15 07:10:37 +08:00
27 lines
466 B
C++
27 lines
466 B
C++
#include "../src/Core.h"
|
|
|
|
USING_EIGEN_DATA_TYPES
|
|
|
|
using namespace std;
|
|
|
|
template<typename Scalar, typename Derived>
|
|
void foo(const Eigen::MatrixBase<Scalar, Derived>& m)
|
|
{
|
|
cout << "Here's m:" << endl << m << endl;
|
|
}
|
|
|
|
template<typename Scalar, typename Derived>
|
|
Eigen::ScalarMultiple<Derived>
|
|
twice(const Eigen::MatrixBase<Scalar, Derived>& m)
|
|
{
|
|
return 2 * m;
|
|
}
|
|
|
|
int main(int, char**)
|
|
{
|
|
Matrix2d m = Matrix2d::random();
|
|
foo(m);
|
|
foo(twice(m));
|
|
return 0;
|
|
}
|