You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
541 B

  1. #include <StormEigen/Core>
  2. #include <iostream>
  3. using namespace StormEigen;
  4. using namespace std;
  5. // define a custom template binary functor
  6. template<typename Scalar> struct MakeComplexOp {
  7. STORMEIGEN_EMPTY_STRUCT_CTOR(MakeComplexOp)
  8. typedef complex<Scalar> result_type;
  9. complex<Scalar> operator()(const Scalar& a, const Scalar& b) const { return complex<Scalar>(a,b); }
  10. };
  11. int main(int, char**)
  12. {
  13. Matrix4d m1 = Matrix4d::Random(), m2 = Matrix4d::Random();
  14. cout << m1.binaryExpr(m2, MakeComplexOp<double>()) << endl;
  15. return 0;
  16. }