10 #ifndef EIGEN_SELFCWISEBINARYOP_H 11 #define EIGEN_SELFCWISEBINARYOP_H 31 template<
typename BinaryOp,
typename Lhs,
typename Rhs>
33 :
traits<CwiseBinaryOp<BinaryOp,Lhs,Rhs> >
39 OuterStrideAtCompileTime = Lhs::OuterStrideAtCompileTime,
40 InnerStrideAtCompileTime = Lhs::InnerStrideAtCompileTime
55 inline
SelfCwiseBinaryOp(Lhs& xpr, const BinaryOp& func = BinaryOp()) : m_matrix(xpr), m_functor(func) {}
57 inline Index
rows()
const {
return m_matrix.rows(); }
58 inline Index
cols()
const {
return m_matrix.cols(); }
59 inline Index
outerStride()
const {
return m_matrix.outerStride(); }
60 inline Index
innerStride()
const {
return m_matrix.innerStride(); }
61 inline const Scalar*
data()
const {
return m_matrix.data(); }
68 return m_matrix.const_cast_derived().coeffRef(row, col);
72 return m_matrix.coeffRef(row, col);
80 return m_matrix.const_cast_derived().coeffRef(index);
82 inline const Scalar&
coeffRef(Index index)
const 84 return m_matrix.const_cast_derived().coeffRef(index);
87 template<
typename OtherDerived>
90 OtherDerived& _other = other.const_cast_derived();
92 && col >= 0 && col < cols());
93 Scalar& tmp = m_matrix.coeffRef(row,col);
94 tmp = m_functor(tmp, _other.coeff(row,col));
97 template<
typename OtherDerived>
100 OtherDerived& _other = other.const_cast_derived();
102 Scalar& tmp = m_matrix.coeffRef(index);
103 tmp = m_functor(tmp, _other.coeff(index));
106 template<
typename OtherDerived,
int StoreMode,
int LoadMode>
109 OtherDerived& _other = other.const_cast_derived();
111 && col >= 0 && col < cols());
112 m_matrix.template writePacket<StoreMode>(
row,
col,
113 m_functor.packetOp(m_matrix.template packet<StoreMode>(row, col),_other.template packet<LoadMode>(row, col)) );
116 template<
typename OtherDerived,
int StoreMode,
int LoadMode>
119 OtherDerived& _other = other.const_cast_derived();
121 m_matrix.template writePacket<StoreMode>(index,
122 m_functor.packetOp(m_matrix.template packet<StoreMode>(index),_other.template packet<LoadMode>(index)) );
127 template<
typename RhsDerived>
133 #ifdef EIGEN_DEBUG_ASSIGN 136 eigen_assert(rows() == rhs.rows() && cols() == rhs.cols());
138 #ifndef EIGEN_NO_DEBUG 139 this->checkTransposeAliasing(rhs.derived());
150 return Base::operator=(rhs);
171 template<
typename Derived>
174 typedef typename Derived::PlainObject PlainObject;
176 tmp = PlainObject::Constant(rows(),cols(),other);
180 template<
typename Derived>
186 typedef typename Derived::PlainObject PlainObject;
190 else actual_other =
Scalar(1)/other;
191 tmp = PlainObject::Constant(rows(),cols(), actual_other);
197 #endif // EIGEN_SELFCWISEBINARYOP_H void copyPacket(Index row, Index col, const DenseBase< OtherDerived > &other)
const BinaryOp & functor() const
const BinaryOp & m_functor
#define EIGEN_STRONG_INLINE
internal::traits< Derived >::Scalar Scalar
const Scalar & coeffRef(Index index) const
SelfCwiseBinaryOp & operator=(const Rhs &_rhs)
const unsigned int DirectAccessBit
const unsigned int LvalueBit
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
#define eigen_internal_assert(x)
Base class for all dense matrices, vectors, and arrays.
#define EIGEN_STATIC_ASSERT_LVALUE(Derived)
void copyCoeff(Index index, const DenseBase< OtherDerived > &other)
Scalar & coeffRef(Index index)
void copyCoeff(Index row, Index col, const DenseBase< OtherDerived > &other)
internal::packet_traits< Scalar >::type Packet
Index outerStride() const
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
internal::dense_xpr_base< SelfCwiseBinaryOp >::type Base
Derived & operator/=(const Scalar &other)
EIGEN_STRONG_INLINE SelfCwiseBinaryOp & lazyAssign(const DenseBase< RhsDerived > &rhs)
Index innerStride() const
void copyPacket(Index index, const DenseBase< OtherDerived > &other)
Derived & operator*=(const Scalar &other)
const Scalar * data() const
const Scalar & coeffRef(Index row, Index col) const
#define EIGEN_CHECK_BINARY_COMPATIBILIY(BINOP, LHS, RHS)
#define EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(TYPE0, TYPE1)
Scalar & coeffRef(Index row, Index col)