From 721626dfc5cab61ded1a26357b6c3dbb33763dc0 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Sat, 8 Mar 2008 19:02:24 +0000 Subject: * Added support for a comma initializer: mat.block(i,j,2,2) << 1, 2, 3, 4; If the number of coefficients does not match the matrix size, then an assertion is raised. No support for xpr on the right side for the moment. * Added support for assertion checking. This allows to test that an assertion is indeed raised when it should be. * Fixed a mistake in the CwiseUnary example. --- Eigen/src/Core/CwiseBinaryOp.h | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'Eigen/src/Core/CwiseBinaryOp.h') diff --git a/Eigen/src/Core/CwiseBinaryOp.h b/Eigen/src/Core/CwiseBinaryOp.h index cdcc329b5..9d3dd695c 100644 --- a/Eigen/src/Core/CwiseBinaryOp.h +++ b/Eigen/src/Core/CwiseBinaryOp.h @@ -89,23 +89,26 @@ class CwiseBinaryOp : NoOperatorEquals, const BinaryOp m_functor; }; -/** \brief Template functor to compute the sum of two scalars +/** \internal + * \brief Template functor to compute the sum of two scalars * * \sa class CwiseBinaryOp, MatrixBase::operator+ */ -struct CwiseSumOp EIGEN_EMPTY_STRUCT { +struct ScalarSumOp EIGEN_EMPTY_STRUCT { template Scalar operator() (const Scalar& a, const Scalar& b) const { return a + b; } }; -/** \brief Template functor to compute the difference of two scalars +/** \internal + * \brief Template functor to compute the difference of two scalars * * \sa class CwiseBinaryOp, MatrixBase::operator- */ -struct CwiseDifferenceOp EIGEN_EMPTY_STRUCT { +struct ScalarDifferenceOp EIGEN_EMPTY_STRUCT { template Scalar operator() (const Scalar& a, const Scalar& b) const { return a - b; } }; -/** \brief Template functor to compute the product of two scalars +/** \internal + * \brief Template functor to compute the product of two scalars * * \sa class CwiseBinaryOp, MatrixBase::cwiseProduct() */ @@ -113,7 +116,8 @@ struct ScalarProductOp EIGEN_EMPTY_STRUCT { template Scalar operator() (const Scalar& a, const Scalar& b) const { return a * b; } }; -/** \brief Template functor to compute the quotient of two scalars +/** \internal + * \brief Template functor to compute the quotient of two scalars * * \sa class CwiseBinaryOp, MatrixBase::cwiseQuotient() */ @@ -128,10 +132,10 @@ struct ScalarQuotientOp EIGEN_EMPTY_STRUCT { * \sa class CwiseBinaryOp, MatrixBase::operator-=() */ template -const CwiseBinaryOp +const CwiseBinaryOp operator-(const MatrixBase &mat1, const MatrixBase &mat2) { - return CwiseBinaryOp(mat1.asArg(), mat2.asArg()); + return CwiseBinaryOp(mat1.asArg(), mat2.asArg()); } /** replaces \c *this by \c *this - \a other. @@ -154,10 +158,10 @@ MatrixBase::operator-=(const MatrixBase & * \sa class CwiseBinaryOp, MatrixBase::operator+=() */ template -const CwiseBinaryOp +const CwiseBinaryOp operator+(const MatrixBase &mat1, const MatrixBase &mat2) { - return CwiseBinaryOp(mat1.asArg(), mat2.asArg()); + return CwiseBinaryOp(mat1.asArg(), mat2.asArg()); } /** replaces \c *this by \c *this + \a other. @@ -203,7 +207,7 @@ MatrixBase::cwiseQuotient(const MatrixBase -- cgit v1.2.3