aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core
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
parentd0261bd26c3900a5e52da3574fc2aeab3392c30b (diff)
Fix usage of Dense versus DenseShape
Diffstat (limited to 'Eigen/src/Core')
-rw-r--r--Eigen/src/Core/AssignEvaluator.h31
-rw-r--r--Eigen/src/Core/CoreEvaluators.h4
-rw-r--r--Eigen/src/Core/ProductEvaluators.h4
-rw-r--r--Eigen/src/Core/util/Constants.h12
4 files changed, 30 insertions, 21 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,
diff --git a/Eigen/src/Core/CoreEvaluators.h b/Eigen/src/Core/CoreEvaluators.h
index 9460e675f..961b56e55 100644
--- a/Eigen/src/Core/CoreEvaluators.h
+++ b/Eigen/src/Core/CoreEvaluators.h
@@ -42,14 +42,14 @@ template<typename StorageKind> struct storage_kind_to_shape;
template<>
struct storage_kind_to_shape<Dense> {
- typedef Dense Shape;
+ typedef DenseShape Shape;
};
// TODO to be moved to SparseCore:
/*
template<>
struct storage_kind_to_shape<Sparse> {
- typedef Sparse Shape;
+ typedef SparseSpape Shape;
};
*/
diff --git a/Eigen/src/Core/ProductEvaluators.h b/Eigen/src/Core/ProductEvaluators.h
index e3a893651..51228be5f 100644
--- a/Eigen/src/Core/ProductEvaluators.h
+++ b/Eigen/src/Core/ProductEvaluators.h
@@ -48,7 +48,7 @@ struct dense_product_impl;
// The evaluator for default dense products creates a temporary and call dense_product_impl
template<typename Lhs, typename Rhs, int ProductTag>
-struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, ProductTag, Dense, Dense, typename Lhs::Scalar, typename Rhs::Scalar>
+struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, ProductTag, DenseShape, DenseShape, typename Lhs::Scalar, typename Rhs::Scalar>
: public evaluator<typename Product<Lhs, Rhs, DefaultProduct>::PlainObject>::type
{
typedef Product<Lhs, Rhs, DefaultProduct> XprType;
@@ -217,7 +217,7 @@ template<int StorageOrder, int UnrollingIndex, typename Lhs, typename Rhs, typen
struct etor_product_packet_impl;
template<typename Lhs, typename Rhs, int ProductTag>
-struct product_evaluator<Product<Lhs, Rhs, LazyProduct>, ProductTag, Dense, Dense, typename Lhs::Scalar, typename Rhs::Scalar >
+struct product_evaluator<Product<Lhs, Rhs, LazyProduct>, ProductTag, DenseShape, DenseShape, typename Lhs::Scalar, typename Rhs::Scalar >
: evaluator_base<Product<Lhs, Rhs, LazyProduct> >
{
typedef Product<Lhs, Rhs, LazyProduct> XprType;
diff --git a/Eigen/src/Core/util/Constants.h b/Eigen/src/Core/util/Constants.h
index 3178ff06e..14449eb6c 100644
--- a/Eigen/src/Core/util/Constants.h
+++ b/Eigen/src/Core/util/Constants.h
@@ -440,6 +440,18 @@ struct MatrixXpr {};
/** The type used to identify an array expression */
struct ArrayXpr {};
+
+#ifdef EIGEN_ENABLE_EVALUATORS
+// An evaluator must define its shape. By default, it can be one of the following:
+struct DenseShape { static std::string debugName() { return "DenseShape"; } };
+struct DiagonalShape { static std::string debugName() { return "DiagonalShape"; } };
+struct BandShape { static std::string debugName() { return "BandShape"; } };
+struct TriangularShape { static std::string debugName() { return "TriangularShape"; } };
+struct SelfAdjointShape { static std::string debugName() { return "SelfAdjointShape"; } };
+struct SparseShape { static std::string debugName() { return "SparseShape"; } };
+#endif
+
+
} // end namespace Eigen
#endif // EIGEN_CONSTANTS_H