aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/AssignEvaluator.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2013-12-02 14:05:34 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2013-12-02 14:05:34 +0100
commit27ca9437a1e191f20724492275bf0b1415eee2d6 (patch)
tree736ed8769f9c4ba0e14fd8ee6b34013a00fcc958 /Eigen/src/Core/AssignEvaluator.h
parentd0261bd26c3900a5e52da3574fc2aeab3392c30b (diff)
Fix usage of Dense versus DenseShape
Diffstat (limited to 'Eigen/src/Core/AssignEvaluator.h')
-rw-r--r--Eigen/src/Core/AssignEvaluator.h31
1 files changed, 14 insertions, 17 deletions
diff --git a/Eigen/src/Core/AssignEvaluator.h b/Eigen/src/Core/AssignEvaluator.h
index 2f18cbc95..2c9f2426b 100644
--- a/Eigen/src/Core/AssignEvaluator.h
+++ b/Eigen/src/Core/AssignEvaluator.h
@@ -526,6 +526,8 @@ public:
Index size() const { return m_dstExpr.size(); }
Index innerSize() const { return m_dstExpr.innerSize(); }
Index outerSize() const { return m_dstExpr.outerSize(); }
+ Index rows() const { return m_dstExpr.rows(); }
+ Index cols() const { return m_dstExpr.cols(); }
Index outerStride() const { return m_dstExpr.outerStride(); }
// TODO get rid of this one:
@@ -534,16 +536,25 @@ public:
DstEvaluatorType& dstEvaluator() { return m_dst; }
const SrcEvaluatorType& srcEvaluator() const { return m_src; }
+ /// Assign src(row,col) to dst(row,col) through the assignment functor.
void assignCoeff(Index row, Index col)
{
m_functor.assignCoeff(m_dst.coeffRef(row,col), m_src.coeff(row,col));
}
+ /// This overload by-passes the source expression, i.e., dst(row,col) ?= value
+ void assignCoeff(Index row, Index col, const Scalar &value)
+ {
+ m_functor.assignCoeff(m_dst.coeffRef(row,col), value);
+ }
+
+ /// \sa assignCoeff(Index,Index)
void assignCoeff(Index index)
{
m_functor.assignCoeff(m_dst.coeffRef(index), m_src.coeff(index));
}
+ /// \sa assignCoeff(Index,Index)
void assignCoeffByOuterInner(Index outer, Index inner)
{
Index row = rowIndexByOuterInner(outer, inner);
@@ -633,29 +644,15 @@ void call_dense_assignment_loop(const DstXprType& dst, const SrcXprType& src)
* Part 6 : Generic assignment
***************************************************************************/
-
-// An evaluator must define its shape. It can be one of the following:
-struct DenseShape {};
-struct DiagonalShape {};
-struct BandShape {};
-struct TriangularShape {};
-struct SelfAdjointShape {};
-struct SparseShape {};
-
-
// Based on the respective shapes of the destination and source,
// the class AssignmentKind determine the kind of assignment mechanism.
// AssignmentKind must define a Kind typedef.
template<typename DstShape, typename SrcShape> struct AssignmentKind;
-// AssignmentKind<.,.>::Kind can be one of the following:
- struct Dense2Dense {};
- struct Triangular2Triangular {};
-// struct Diagonal2Diagonal {}; // <=> Dense2Dense
- struct Sparse2Dense {};
- struct Sparse2Sparse {};
+// Assignement kind defined in this file:
+struct Dense2Dense {};
-template<> struct AssignmentKind<Dense,Dense> { typedef Dense2Dense Kind; };
+template<> struct AssignmentKind<DenseShape,DenseShape> { typedef Dense2Dense Kind; };
// This is the main assignment class
template< typename DstXprType, typename SrcXprType, typename Functor,