11 #ifndef EIGEN_CWISE_BINARY_OP_H 12 #define EIGEN_CWISE_BINARY_OP_H 37 template<
typename BinaryOp,
typename Lhs,
typename Rhs>
68 LhsCoeffReadCost = _LhsNested::CoeffReadCost,
69 RhsCoeffReadCost = _RhsNested::CoeffReadCost,
70 LhsFlags = _LhsNested::Flags,
71 RhsFlags = _RhsNested::Flags,
74 Flags0 = (
int(LhsFlags) | int(RhsFlags)) & (
76 | (
int(LhsFlags) &
int(RhsFlags) &
96 #define EIGEN_CHECK_BINARY_COMPATIBILIY(BINOP,LHS,RHS) \ 97 EIGEN_STATIC_ASSERT((internal::functor_is_product_like<BINOP>::ret \ 98 ? int(internal::scalar_product_traits<LHS, RHS>::Defined) \ 99 : int(internal::is_same<LHS, RHS>::value)), \ 100 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) 102 template<
typename BinaryOp,
typename Lhs,
typename Rhs,
typename StorageKind>
105 template<
typename BinaryOp,
typename Lhs,
typename Rhs>
109 typename internal::promote_storage_type<typename internal::traits<Lhs>::StorageKind,
110 typename internal::traits<Rhs>::StorageKind>::ret>
120 typedef typename
internal::nested<Lhs>::type LhsNested;
121 typedef typename
internal::nested<Rhs>::type RhsNested;
122 typedef typename
internal::remove_reference<LhsNested>::type _LhsNested;
123 typedef typename
internal::remove_reference<RhsNested>::type _RhsNested;
126 : m_lhs(aLhs), m_rhs(aRhs), m_functor(func)
131 eigen_assert(aLhs.rows() == aRhs.rows() && aLhs.cols() == aRhs.cols());
150 const _LhsNested&
lhs()
const {
return m_lhs; }
152 const _RhsNested&
rhs()
const {
return m_rhs; }
154 const BinaryOp&
functor()
const {
return m_functor; }
162 template<
typename BinaryOp,
typename Lhs,
typename Rhs>
174 return derived().functor()(derived().lhs().coeff(rowId, colId),
175 derived().rhs().coeff(rowId, colId));
178 template<
int LoadMode>
181 return derived().functor().packetOp(derived().lhs().
template packet<LoadMode>(rowId, colId),
182 derived().rhs().
template packet<LoadMode>(rowId, colId));
187 return derived().functor()(derived().lhs().coeff(index),
188 derived().rhs().coeff(index));
191 template<
int LoadMode>
194 return derived().functor().packetOp(derived().lhs().
template packet<LoadMode>(index),
195 derived().rhs().
template packet<LoadMode>(index));
203 template<
typename Derived>
204 template<
typename OtherDerived>
209 tmp = other.derived();
217 template<
typename Derived>
218 template<
typename OtherDerived>
223 tmp = other.derived();
229 #endif // EIGEN_CWISE_BINARY_OP_H #define EIGEN_GENERIC_PUBLIC_INTERFACE(Derived)
EIGEN_STRONG_INLINE Index cols() const
EIGEN_STRONG_INLINE Index rows() const
#define EIGEN_STRONG_INLINE
EIGEN_STRONG_INLINE PacketScalar packet(Index rowId, Index colId) const
CwiseBinaryOpImpl< BinaryOp, Lhs, Rhs, typename internal::promote_storage_type< typename internal::traits< Lhs >::StorageKind, typename internal::traits< Rhs >::StorageKind >::ret >::Base Base
traits< Ancestor >::XprKind XprKind
promote_storage_type< typename traits< Lhs >::StorageKind, typename traits< Rhs >::StorageKind >::ret StorageKind
Derived & operator+=(const MatrixBase< OtherDerived > &other)
remove_reference< LhsNested >::type _LhsNested
const unsigned int RowMajorBit
const unsigned int PacketAccessBit
const _LhsNested & lhs() const
const unsigned int AlignedBit
Generic expression where a coefficient-wise binary operator is applied to two expressions.
const unsigned int HereditaryBits
const _RhsNested & rhs() const
remove_reference< RhsNested >::type _RhsNested
Derived & operator-=(const MatrixBase< OtherDerived > &other)
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
remove_all< Lhs >::type Ancestor
result_of< BinaryOp(typename Lhs::Scalar, typename Rhs::Scalar) >::type Scalar
EIGEN_STRONG_INLINE const Scalar coeff(Index index) const
Base class for all dense matrices, vectors, and expressions.
EIGEN_STRONG_INLINE PacketScalar packet(Index index) const
const unsigned int LinearAccessBit
internal::dense_xpr_base< CwiseBinaryOp< BinaryOp, Lhs, Rhs > >::type Base
CwiseBinaryOp< BinaryOp, Lhs, Rhs > Derived
#define EIGEN_CHECK_BINARY_COMPATIBILIY(BINOP, LHS, RHS)
const BinaryOp & functor() const
#define EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(TYPE0, TYPE1)
promote_index_type< typename traits< Lhs >::Index, typename traits< Rhs >::Index >::type Index