aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/CwiseBinaryOp.h
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-06-26 16:06:41 +0000
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-06-26 16:06:41 +0000
commit25ba9f377c97968923cd654d419fa8ce260f114d (patch)
tree52003e7b8896a534603ecd161b31262aa8761fed /Eigen/src/Core/CwiseBinaryOp.h
parent5b0da4b778d8f51e21dd7c35f6f7397c38c6be03 (diff)
* add bench/benchVecAdd.cpp by Gael, fix crash (ei_pload on non-aligned)
* introduce packet(int), make use of it in linear vectorized paths --> completely fixes the slowdown noticed in benchVecAdd. * generalize coeff(int) to linear-access xprs * clarify the access flag bits * rework api dox in Coeffs.h and util/Constants.h * improve certain expressions's flags, allowing more vectorization * fix bug in Block: start(int) and end(int) returned dyn*dyn size * fix bug in Block: just because the Eval type has packet access doesn't imply the block xpr should have it too.
Diffstat (limited to 'Eigen/src/Core/CwiseBinaryOp.h')
-rw-r--r--Eigen/src/Core/CwiseBinaryOp.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/Eigen/src/Core/CwiseBinaryOp.h b/Eigen/src/Core/CwiseBinaryOp.h
index ec4619781..6672edcbe 100644
--- a/Eigen/src/Core/CwiseBinaryOp.h
+++ b/Eigen/src/Core/CwiseBinaryOp.h
@@ -69,7 +69,7 @@ struct ei_traits<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
HereditaryBits
| (int(LhsFlags) & int(RhsFlags) & LinearAccessBit)
| (ei_functor_traits<BinaryOp>::PacketAccess && ((int(LhsFlags) & RowMajorBit)==(int(RhsFlags) & RowMajorBit))
- ? int(LhsFlags) & int(RhsFlags) & PacketAccessBit : 0)),
+ ? (int(LhsFlags) & int(RhsFlags) & PacketAccessBit) : 0)),
CoeffReadCost = LhsCoeffReadCost + RhsCoeffReadCost + ei_functor_traits<BinaryOp>::Cost
};
};
@@ -108,6 +108,17 @@ class CwiseBinaryOp : ei_no_assignment_operator,
return m_functor.packetOp(m_lhs.template packet<LoadMode>(row, col), m_rhs.template packet<LoadMode>(row, col));
}
+ inline const Scalar _coeff(int index) const
+ {
+ return m_functor(m_lhs.coeff(index), m_rhs.coeff(index));
+ }
+
+ template<int LoadMode>
+ inline PacketScalar _packet(int index) const
+ {
+ return m_functor.packetOp(m_lhs.template packet<LoadMode>(index), m_rhs.template packet<LoadMode>(index));
+ }
+
protected:
const LhsNested m_lhs;
const RhsNested m_rhs;