Skip to content

Commit

Permalink
fix: allow for product entries of different types and avoid compile e…
Browse files Browse the repository at this point in the history
…rror C2039: 'ReturnType': is not a member of 'Eigen::ScalarBinaryOpTraits...'
  • Loading branch information
Konrad Schatz authored and guestieng committed Jun 30, 2022
1 parent cfa2289 commit e10c38c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions include/cppad/example/cppad_eigen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,20 @@ namespace Eigen {
static CppAD::AD<Base> infinity(void)
{ return CppAD::numeric_limits< CppAD::AD<Base> >::infinity(); }
};

/**
* Determines that the given binary operation of two numeric types involving
* an AD<Base> is allowed and what the scalar return type is
*/
template<typename S, typename BinOp>
struct ScalarBinaryOpTraits<CppAD::AD<S>,S,BinOp>{
typedef CppAD::AD<S> ReturnType;
};
template<typename S, typename BinOp>
struct ScalarBinaryOpTraits<S,CppAD::AD<S>,BinOp>
{
typedef CppAD::AD<S> ReturnType;
};
}
/* %$$
Expand Down

0 comments on commit e10c38c

Please sign in to comment.