eigen/doc/example.cpp
Benoit Jacob a52c74095f rename src/ to Eigen/ so that we're able to #include<Eigen/Core.h>
in the examples instead of ugly things like #include"../../src/Core.h"
2007-12-20 21:25:13 +00:00

27 lines
465 B
C++

#include <Eigen/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;
}