11 #ifndef EIGEN_CWISE_BINARY_OP_H
12 #define EIGEN_CWISE_BINARY_OP_H
17 template<
typename BinaryOp,
typename Lhs,
typename Rhs>
22 typedef typename remove_all<Lhs>::type Ancestor;
35 const typename Lhs::Scalar&,
36 const typename Rhs::Scalar&
41 BinaryOp>::ret StorageKind;
44 typedef typename Lhs::Nested LhsNested;
45 typedef typename Rhs::Nested RhsNested;
46 typedef typename remove_reference<LhsNested>::type _LhsNested;
47 typedef typename remove_reference<RhsNested>::type _RhsNested;
54 template<
typename BinaryOp,
typename Lhs,
typename Rhs,
typename StorageKind>
76 template<
typename BinaryOp,
typename LhsType,
typename RhsType>
79 BinaryOp, LhsType, RhsType,
80 typename internal::cwise_promote_storage_type<typename internal::traits<LhsType>::StorageKind,
81 typename internal::traits<RhsType>::StorageKind,
87 typedef typename internal::remove_all<BinaryOp>::type Functor;
88 typedef typename internal::remove_all<LhsType>::type Lhs;
89 typedef typename internal::remove_all<RhsType>::type Rhs;
92 BinaryOp, LhsType, RhsType,
95 BinaryOp>::ret>::Base Base;
100 typedef typename internal::remove_reference<LhsNested>::type _LhsNested;
101 typedef typename internal::remove_reference<RhsNested>::type _RhsNested;
103 #if EIGEN_COMP_MSVC && EIGEN_HAS_CXX11
105 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
109 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
110 CwiseBinaryOp(
const Lhs& aLhs,
const Rhs& aRhs,
const BinaryOp& func = BinaryOp())
111 : m_lhs(aLhs), m_rhs(aRhs), m_functor(func)
113 EIGEN_CHECK_BINARY_COMPATIBILIY(BinaryOp,
typename Lhs::Scalar,
typename Rhs::Scalar);
115 EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Lhs, Rhs)
116 eigen_assert(aLhs.rows() == aRhs.rows() && aLhs.cols() == aRhs.cols());
119 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
127 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
137 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
138 const _LhsNested&
lhs()
const {
return m_lhs; }
140 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
141 const _RhsNested&
rhs()
const {
return m_rhs; }
143 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
144 const BinaryOp&
functor()
const {
return m_functor; }
149 const BinaryOp m_functor;
153 template<
typename BinaryOp,
typename Lhs,
typename Rhs,
typename StorageKind>
165 template<
typename Derived>
166 template<
typename OtherDerived>
167 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived &
178 template<
typename Derived>
179 template<
typename OtherDerived>
180 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived &
189 #endif // EIGEN_CWISE_BINARY_OP_H