aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/CoreEvaluators.h
diff options
context:
space:
mode:
authorGravatar Jitse Niesen <jitse@maths.leeds.ac.uk>2011-03-27 13:49:15 +0100
committerGravatar Jitse Niesen <jitse@maths.leeds.ac.uk>2011-03-27 13:49:15 +0100
commit1b17a674dd409ea55cea4079ba9b8db18778e012 (patch)
tree1929e8be6e1064c821119bcf9543d2f26aa75046 /Eigen/src/Core/CoreEvaluators.h
parent5c204d1ff7b7b57bba2ef6e5701597d000e63842 (diff)
Evaluators: Implement inner vectorization.
The implementation is minimal (I only wrote the functions called by the unit test) and ugly (lots of copy and pasting).
Diffstat (limited to 'Eigen/src/Core/CoreEvaluators.h')
-rw-r--r--Eigen/src/Core/CoreEvaluators.h80
1 files changed, 80 insertions, 0 deletions
diff --git a/Eigen/src/Core/CoreEvaluators.h b/Eigen/src/Core/CoreEvaluators.h
index 5666daae9..c06d9303e 100644
--- a/Eigen/src/Core/CoreEvaluators.h
+++ b/Eigen/src/Core/CoreEvaluators.h
@@ -71,6 +71,27 @@ struct evaluator_impl<Transpose<ExpressionType> >
return m_argImpl.template packet<LoadMode>(index);
}
+ // TODO: Difference between PacketScalar and PacketReturnType?
+ // TODO: Get this function by inheriting from DenseCoeffBase?
+ template<int LoadMode>
+ const typename ExpressionType::PacketScalar packetByOuterInner(Index outer, Index inner) const
+ {
+ return m_argImpl.template packetByOuterInner<LoadMode>(outer, inner);
+ }
+
+// TODO: Is this function needed?
+// template<int StoreMode>
+// void writePacket(Index index, const typename ExpressionType::PacketScalar& x)
+// {
+// m_argImpl.template writePacket<StoreMode>(index, x);
+// }
+
+ template<int StoreMode>
+ void writePacketByOuterInner(Index outer, Index inner, const typename ExpressionType::PacketScalar& x)
+ {
+ m_argImpl.template writePacketByOuterInner<StoreMode>(outer, inner, x);
+ }
+
protected:
typename evaluator<ExpressionType>::type m_argImpl;
};
@@ -86,6 +107,16 @@ struct evaluator_impl<Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols> >
typedef typename MatrixType::Index Index;
+ Index colIndexByOuterInner(Index outer, Index inner) const
+ {
+ return m_matrix.colIndexByOuterInner(outer, inner);
+ }
+
+ Index rowIndexByOuterInner(Index outer, Index inner) const
+ {
+ return m_matrix.rowIndexByOuterInner(outer, inner);
+ }
+
typename MatrixType::CoeffReturnType coeff(Index i, Index j) const
{
return m_matrix.coeff(i, j);
@@ -103,6 +134,18 @@ struct evaluator_impl<Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols> >
return m_matrix.template packet<LoadMode>(index);
}
+ template<int LoadMode>
+ typename MatrixType::PacketReturnType packet(Index row, Index col) const
+ {
+ return m_matrix.template packet<LoadMode>(row, col);
+ }
+
+ template<int LoadMode>
+ typename MatrixType::PacketReturnType packetByOuterInner(Index outer, Index inner) const
+ {
+ return m_matrix.template packetByOuterInner<LoadMode>(outer, inner);
+ }
+
template<int StoreMode>
void writePacket(Index index, const typename MatrixType::PacketScalar& x)
{
@@ -110,6 +153,12 @@ struct evaluator_impl<Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols> >
m_matrix.const_cast_derived().template writePacket<StoreMode>(index, x);
}
+ template<int StoreMode>
+ void writePacketByOuterInner(Index outer, Index inner, const typename MatrixType::PacketScalar& x)
+ {
+ m_matrix.const_cast_derived().template writePacketByOuterInner<StoreMode>(outer, inner, x);
+ }
+
protected:
const MatrixType &m_matrix;
};
@@ -149,6 +198,18 @@ struct evaluator_impl<Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols> >
return m_array.template packet<LoadMode>(index);
}
+ template<int LoadMode>
+ typename ArrayType::PacketReturnType packet(Index row, Index col) const
+ {
+ return m_array.template packet<LoadMode>(row, col);
+ }
+
+ template<int LoadMode>
+ typename ArrayType::PacketReturnType packetByOuterInner(Index outer, Index inner) const
+ {
+ return m_array.template packetByOuterInner<LoadMode>(outer, inner);
+ }
+
template<int StoreMode>
void writePacket(Index index, const typename ArrayType::PacketScalar& x)
{
@@ -156,6 +217,12 @@ struct evaluator_impl<Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols> >
m_array.const_cast_derived().template writePacket<StoreMode>(index, x);
}
+ template<int StoreMode>
+ void writePacketByOuterInner(Index outer, Index inner, const typename ArrayType::PacketScalar& x)
+ {
+ m_array.const_cast_derived().template writePacketByOuterInner<StoreMode>(outer, inner, x);
+ }
+
protected:
const ArrayType &m_array;
};
@@ -208,6 +275,19 @@ struct evaluator_impl<CwiseUnaryOp<UnaryOp, ArgType> >
return m_unaryOp.functor().packetOp(m_argImpl.template packet<LoadMode>(index));
}
+ template<int LoadMode>
+ typename UnaryOpType::PacketScalar packet(Index row, Index col) const
+ {
+ return m_unaryOp.functor().packetOp(m_argImpl.template packet<LoadMode>(row, col));
+ }
+
+ template<int LoadMode>
+ typename UnaryOpType::PacketScalar packetByOuterInner(Index outer, Index inner) const
+ {
+ return packet<LoadMode>(m_argImpl.rowIndexByOuterInner(outer, inner),
+ m_argImpl.colIndexByOuterInner(outer, inner));
+ }
+
protected:
const UnaryOpType& m_unaryOp;
typename evaluator<ArgType>::type m_argImpl;