40 typename promote_index_type<typename traits<Lhs>::StorageIndex,
typename traits<Rhs>::StorageIndex>::type;
46 Flags = cwise_promote_storage_order<typename traits<Lhs>::StorageKind,
typename traits<Rhs>::StorageKind,
76class CwiseBinaryOp :
public CwiseBinaryOpImpl<BinaryOp, LhsType, RhsType,
77 typename internal::cwise_promote_storage_type<
78 typename internal::traits<LhsType>::StorageKind,
79 typename internal::traits<RhsType>::StorageKind, BinaryOp>::ret>,
80 internal::no_assignment_operator {
82 using Functor = internal::remove_all_t<BinaryOp>;
83 using Lhs = internal::remove_all_t<LhsType>;
84 using Rhs = internal::remove_all_t<RhsType>;
86 using Base =
typename CwiseBinaryOpImpl<
87 BinaryOp, LhsType, RhsType,
88 typename internal::cwise_promote_storage_type<typename internal::traits<LhsType>::StorageKind,
89 typename internal::traits<Rhs>::StorageKind, BinaryOp>::ret>::Base;
90 EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseBinaryOp)
92 EIGEN_CHECK_BINARY_COMPATIBILITY(BinaryOp,
typename Lhs::Scalar,
typename Rhs::Scalar)
93 EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Lhs, Rhs)
95 using LhsNested =
typename internal::ref_selector<LhsType>::type;
96 using RhsNested =
typename internal::ref_selector<RhsType>::type;
97 using LhsNested_ = std::remove_reference_t<LhsNested>;
98 using RhsNested_ = std::remove_reference_t<RhsNested>;
100 EIGEN_DEVICE_FUNC
constexpr EIGEN_STRONG_INLINE CwiseBinaryOp(
const Lhs& aLhs,
const Rhs& aRhs,
101 const BinaryOp& func = BinaryOp())
102 : m_lhs(aLhs), m_rhs(aRhs), m_functor(func) {
103 eigen_assert(aLhs.rows() == aRhs.rows() && aLhs.cols() == aRhs.cols());
106 EIGEN_DEVICE_FUNC
constexpr Index rows()
const noexcept {
108 return internal::traits<internal::remove_all_t<LhsNested>>::RowsAtCompileTime == Dynamic ? m_rhs.rows()
111 EIGEN_DEVICE_FUNC
constexpr Index cols()
const noexcept {
113 return internal::traits<internal::remove_all_t<LhsNested>>::ColsAtCompileTime == Dynamic ? m_rhs.cols()
118 EIGEN_DEVICE_FUNC
constexpr EIGEN_STRONG_INLINE
const LhsNested_&
lhs()
const {
return m_lhs; }
120 EIGEN_DEVICE_FUNC
constexpr EIGEN_STRONG_INLINE
const RhsNested_&
rhs()
const {
return m_rhs; }
122 EIGEN_DEVICE_FUNC
constexpr EIGEN_STRONG_INLINE
const BinaryOp&
functor()
const {
return m_functor; }
127 const BinaryOp m_functor;
143EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Derived& MatrixBase<Derived>::operator-=(
const MatrixBase<OtherDerived>& other) {
144 call_assignment(derived(), other.derived(), internal::sub_assign_op<Scalar, typename OtherDerived::Scalar>());
154EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Derived& MatrixBase<Derived>::operator+=(
const MatrixBase<OtherDerived>& other) {
155 call_assignment(derived(), other.derived(), internal::add_assign_op<Scalar, typename OtherDerived::Scalar>());