mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Added initial experimental support for explicit vectorization.
Currently only the following platform/operations are supported: - SSE2 compatible architecture - compiler compatible with intel's SSE2 intrinsics - float, double and int data types - fixed size matrices with a storage major dimension multiple of 4 (or 2 for double) - scalar-matrix product, component wise: +,-,*,min,max - matrix-matrix product only if the left matrix is vectorizable and column major or the right matrix is vectorizable and row major, e.g.: a.transpose() * b is not vectorized with the default column major storage. To use it you must define EIGEN_VECTORIZE and EIGEN_INTEL_PLATFORM.
This commit is contained in:
@@ -60,7 +60,9 @@ struct ei_traits<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
|
||||
ColsAtCompileTime = Lhs::ColsAtCompileTime,
|
||||
MaxRowsAtCompileTime = Lhs::MaxRowsAtCompileTime,
|
||||
MaxColsAtCompileTime = Lhs::MaxColsAtCompileTime,
|
||||
Flags = Lhs::Flags | Rhs::Flags,
|
||||
Flags = ((Lhs::Flags | Rhs::Flags) & ~VectorizableBit)
|
||||
| (ei_functor_traits<BinaryOp>::IsVectorizable && ((Lhs::Flags&RowMajorBit)==(Rhs::Flags&RowMajorBit))
|
||||
? (Lhs::Flags & Rhs::Flags & VectorizableBit) : 0),
|
||||
CoeffReadCost = Lhs::CoeffReadCost + Rhs::CoeffReadCost + ei_functor_traits<BinaryOp>::Cost
|
||||
};
|
||||
};
|
||||
@@ -89,6 +91,11 @@ class CwiseBinaryOp : ei_no_assignment_operator,
|
||||
return m_functor(m_lhs.coeff(row, col), m_rhs.coeff(row, col));
|
||||
}
|
||||
|
||||
PacketScalar _packetCoeff(int row, int col) const
|
||||
{
|
||||
return m_functor.packetOp(m_lhs.packetCoeff(row, col), m_rhs.packetCoeff(row, col));
|
||||
}
|
||||
|
||||
protected:
|
||||
const typename Lhs::XprCopy m_lhs;
|
||||
const typename Rhs::XprCopy m_rhs;
|
||||
|
||||
Reference in New Issue
Block a user