-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInternalBinaryMathEigen.h
More file actions
54 lines (47 loc) · 1.73 KB
/
InternalBinaryMathEigen.h
File metadata and controls
54 lines (47 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "Eigen/Eigen"
#ifndef FUNCEXPR
#define FUNCEXPR return a;
#endif
namespace NMSPC
{
template<typename Arg1, typename Arg2>
struct binary_op_base
{
typedef Arg1 first_argument_type;
typedef Arg2 second_argument_type;
};
template<typename LhsScalar, typename RhsScalar>
struct FUNCNAME : binary_op_base<LhsScalar, RhsScalar>
{
typedef typename Eigen::ScalarBinaryOpTraits<LhsScalar, RhsScalar, FUNCNAME>::ReturnType result_type;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator() (const LhsScalar& a, const RhsScalar& b) const
{
FUNCEXPR
}
template<typename Packet>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& a, const Packet& b) const
{
FUNCEXPR
}
template<typename Packet>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type predux(const Packet& a) const
{
return a;
}
};
}
template<typename LhsType, typename RhsType>
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE
const Eigen::Matrix<typename LhsType::Scalar, LhsType::RowsAtCompileTime, LhsType::ColsAtCompileTime>
FUNCNAME(const Eigen::MatrixBase<LhsType>& derived, const Eigen::MatrixBase<RhsType>& otherDerived)
{
typedef LhsType::Scalar LhsScalar;
typedef RhsType::Scalar RhsScalar;
typedef const Eigen::Matrix<LhsScalar, LhsType::RowsAtCompileTime, LhsType::ColsAtCompileTime> BinaryApllyLhsType;
typedef const Eigen::Matrix<RhsScalar, RhsType::RowsAtCompileTime, RhsType::ColsAtCompileTime> BinaryApllyRhsType;
return Eigen::CwiseBinaryOp
<
NMSPC::FUNCNAME<LhsScalar, RhsScalar>, BinaryApllyLhsType, BinaryApllyRhsType
>(derived, otherDerived).eval();
}