23 template<
typename ExpressionType>
36 inline
SwapWrapper(ExpressionType& xpr) : m_expression(xpr) {}
38 inline Index
rows()
const {
return m_expression.rows(); }
39 inline Index
cols()
const {
return m_expression.cols(); }
40 inline Index
outerStride()
const {
return m_expression.outerStride(); }
41 inline Index
innerStride()
const {
return m_expression.innerStride(); }
49 inline ScalarWithConstIfNotLvalue*
data() {
return m_expression.data(); }
50 inline const Scalar*
data()
const {
return m_expression.data(); }
52 inline Scalar&
coeffRef(Index rowId, Index colId)
54 return m_expression.const_cast_derived().coeffRef(rowId, colId);
59 return m_expression.const_cast_derived().coeffRef(index);
62 inline Scalar&
coeffRef(Index rowId, Index colId)
const 64 return m_expression.coeffRef(rowId, colId);
69 return m_expression.coeffRef(index);
72 template<
typename OtherDerived>
75 OtherDerived& _other = other.const_cast_derived();
77 && colId >= 0 && colId < cols());
78 Scalar tmp = m_expression.coeff(rowId, colId);
79 m_expression.coeffRef(rowId, colId) = _other.coeff(rowId, colId);
80 _other.coeffRef(rowId, colId) = tmp;
83 template<
typename OtherDerived>
86 OtherDerived& _other = other.const_cast_derived();
88 Scalar tmp = m_expression.coeff(index);
89 m_expression.coeffRef(index) = _other.coeff(index);
90 _other.coeffRef(index) = tmp;
93 template<
typename OtherDerived,
int StoreMode,
int LoadMode>
96 OtherDerived& _other = other.const_cast_derived();
98 && colId >= 0 && colId < cols());
99 Packet tmp = m_expression.template packet<StoreMode>(rowId, colId);
100 m_expression.template writePacket<StoreMode>(rowId, colId,
101 _other.template packet<LoadMode>(rowId, colId)
103 _other.template writePacket<LoadMode>(rowId, colId, tmp);
106 template<
typename OtherDerived,
int StoreMode,
int LoadMode>
109 OtherDerived& _other = other.const_cast_derived();
111 Packet tmp = m_expression.template packet<StoreMode>(index);
112 m_expression.template writePacket<StoreMode>(index,
113 _other.template packet<LoadMode>(index)
115 _other.template writePacket<LoadMode>(index, tmp);
126 #endif // EIGEN_SWAP_H internal::conditional< internal::is_lvalue< ExpressionType >::value, Scalar, const Scalar >::type ScalarWithConstIfNotLvalue
Index outerStride() const
ScalarWithConstIfNotLvalue * data()
#define eigen_internal_assert(x)
Scalar & coeffRef(Index index) const
Scalar & coeffRef(Index index)
Base class for all dense matrices, vectors, and arrays.
void copyPacket(Index index, const DenseBase< OtherDerived > &other)
void copyCoeff(Index rowId, Index colId, const DenseBase< OtherDerived > &other)
void copyPacket(Index rowId, Index colId, const DenseBase< OtherDerived > &other)
void copyCoeff(Index index, const DenseBase< OtherDerived > &other)
ExpressionType & m_expression
Scalar & coeffRef(Index rowId, Index colId) const
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
Scalar & coeffRef(Index rowId, Index colId)
const Scalar * data() const
internal::dense_xpr_base< SwapWrapper >::type Base
Index innerStride() const
ExpressionType & expression() const
internal::packet_traits< Scalar >::type Packet