aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2008-08-20 00:58:25 +0000
committerGravatar Gael Guennebaud <g.gael@free.fr>2008-08-20 00:58:25 +0000
commit7aba51ce530e95e062c098ab4fdbfa2de2c5d8da (patch)
tree7b76d457da52b928a7cfe1f60673145ee128742a /Eigen/src
parentc6674ab0767ce121b00389559847457e80728780 (diff)
* Added .all() and .any() members to PartialRedux
* Bug fixes in euler angle snippet, Assign and MapBase * Started a "quick start guide" (draft state)
Diffstat (limited to 'Eigen/src')
-rw-r--r--Eigen/src/Array/PartialRedux.h20
-rw-r--r--Eigen/src/Core/Assign.h2
-rw-r--r--Eigen/src/Core/CommaInitializer.h10
-rw-r--r--Eigen/src/Core/MapBase.h2
4 files changed, 25 insertions, 9 deletions
diff --git a/Eigen/src/Array/PartialRedux.h b/Eigen/src/Array/PartialRedux.h
index bdd657368..e34766aa8 100644
--- a/Eigen/src/Array/PartialRedux.h
+++ b/Eigen/src/Array/PartialRedux.h
@@ -114,6 +114,8 @@ EIGEN_MEMBER_FUNCTOR(norm, (Size+5) * NumTraits<Scalar>::MulCost + (Size-1)*NumT
EIGEN_MEMBER_FUNCTOR(sum, (Size-1)*NumTraits<Scalar>::AddCost);
EIGEN_MEMBER_FUNCTOR(minCoeff, (Size-1)*NumTraits<Scalar>::AddCost);
EIGEN_MEMBER_FUNCTOR(maxCoeff, (Size-1)*NumTraits<Scalar>::AddCost);
+EIGEN_MEMBER_FUNCTOR(all, (Size-1)*NumTraits<Scalar>::AddCost);
+EIGEN_MEMBER_FUNCTOR(any, (Size-1)*NumTraits<Scalar>::AddCost);
/** \internal */
template <typename BinaryOp, typename Scalar>
@@ -216,7 +218,7 @@ template<typename ExpressionType, int Direction> class PartialRedux
*
* Example: \include PartialRedux_norm.cpp
* Output: \verbinclude PartialRedux_norm.out
- *
+ *
* \sa MatrixBase::norm() */
const typename ReturnType<ei_member_norm>::Type norm() const
{ return _expression(); }
@@ -226,11 +228,25 @@ template<typename ExpressionType, int Direction> class PartialRedux
*
* Example: \include PartialRedux_sum.cpp
* Output: \verbinclude PartialRedux_sum.out
- *
+ *
* \sa MatrixBase::sum() */
const typename ReturnType<ei_member_sum>::Type sum() const
{ return _expression(); }
+ /** \returns a row (or column) vector expression representing
+ * whether \b all coefficients of each respective column (or row) are \c true.
+ *
+ * \sa MatrixBase::all() */
+ const typename ReturnType<ei_member_all>::Type all() const
+ { return _expression(); }
+
+ /** \returns a row (or column) vector expression representing
+ * whether \b at \b least one coefficient of each respective column (or row) is \c true.
+ *
+ * \sa MatrixBase::any() */
+ const typename ReturnType<ei_member_any>::Type any() const
+ { return _expression(); }
+
protected:
ExpressionTypeNested m_matrix;
};
diff --git a/Eigen/src/Core/Assign.h b/Eigen/src/Core/Assign.h
index 0145fc7b3..758858165 100644
--- a/Eigen/src/Core/Assign.h
+++ b/Eigen/src/Core/Assign.h
@@ -385,7 +385,7 @@ struct ei_assign_impl<Derived1, Derived2, SliceVectorization, NoUnrolling>
dst.copyCoeff(index, i, src);
}
- alignedStart = (alignedStart+alignedStep)%packetSize;
+ alignedStart = std::min<int>((alignedStart+alignedStep)%packetSize, innerSize);
}
}
};
diff --git a/Eigen/src/Core/CommaInitializer.h b/Eigen/src/Core/CommaInitializer.h
index 137413a7c..c394c3d78 100644
--- a/Eigen/src/Core/CommaInitializer.h
+++ b/Eigen/src/Core/CommaInitializer.h
@@ -53,10 +53,10 @@ struct MatrixBase<Derived>::CommaInitializer
m_col = 0;
m_currentBlockRows = 1;
ei_assert(m_row<m_matrix.rows()
- && "Too many rows passed to MatrixBase::operator<<");
+ && "Too many rows passed to comma initializer (operator<<)");
}
ei_assert(m_col<m_matrix.cols()
- && "Too many coefficients passed to MatrixBase::operator<<");
+ && "Too many coefficients passed to comma initializer (operator<<)");
ei_assert(m_currentBlockRows==1);
m_matrix.coeffRef(m_row, m_col++) = s;
return *this;
@@ -71,10 +71,10 @@ struct MatrixBase<Derived>::CommaInitializer
m_col = 0;
m_currentBlockRows = other.rows();
ei_assert(m_row+m_currentBlockRows<=m_matrix.rows()
- && "Too many rows passed to MatrixBase::operator<<");
+ && "Too many rows passed to comma initializer (operator<<)");
}
ei_assert(m_col<m_matrix.cols()
- && "Too many coefficients passed to MatrixBase::operator<<");
+ && "Too many coefficients passed to comma initializer (operator<<)");
ei_assert(m_currentBlockRows==other.rows());
if (OtherDerived::SizeAtCompileTime != Dynamic)
m_matrix.block<OtherDerived::RowsAtCompileTime != Dynamic ? OtherDerived::RowsAtCompileTime : 1,
@@ -90,7 +90,7 @@ struct MatrixBase<Derived>::CommaInitializer
{
ei_assert((m_row+m_currentBlockRows) == m_matrix.rows()
&& m_col == m_matrix.cols()
- && "Too few coefficients passed to Matrix::operator<<");
+ && "Too few coefficients passed to comma initializer (operator<<)");
}
/** \returns the built matrix once all its coefficients have been set.
diff --git a/Eigen/src/Core/MapBase.h b/Eigen/src/Core/MapBase.h
index 74b7d76aa..4f61d1529 100644
--- a/Eigen/src/Core/MapBase.h
+++ b/Eigen/src/Core/MapBase.h
@@ -47,7 +47,7 @@ template<typename Derived> class MapBase
typedef MatrixBase<Derived> Base;
enum {
- IsRowMajor = int(ei_traits<Derived>::Flags) & RowMajorBit ? 1 : 0,
+ IsRowMajor = (int(ei_traits<Derived>::Flags) & RowMajorBit) ? 1 : 0,
PacketAccess = ei_traits<Derived>::PacketAccess,
RowsAtCompileTime = ei_traits<Derived>::RowsAtCompileTime,
ColsAtCompileTime = ei_traits<Derived>::ColsAtCompileTime,