eigen/doc/example.cpp

27 lines
456 B
C++
Raw Normal View History

#include <Eigen/Core>
2007-09-28 14:17:36 +08:00
USING_PART_OF_NAMESPACE_EIGEN
2007-09-28 14:17:36 +08:00
using namespace std;
template<typename Scalar, typename Derived>
void foo(const MatrixBase<Scalar, Derived>& m)
2007-09-28 14:17:36 +08:00
{
cout << "Here's m:" << endl << m << endl;
2007-09-28 14:17:36 +08:00
}
template<typename Scalar, typename Derived>
Eigen::ScalarMultiple<Derived>
twice(const MatrixBase<Scalar, Derived>& m)
2007-09-28 14:17:36 +08:00
{
return 2 * m;
2007-09-28 14:17:36 +08:00
}
int main(int, char**)
{
Matrix2d m = Matrix2d::random();
foo(m);
foo(twice(m));
return 0;
2007-09-28 14:17:36 +08:00
}