aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/CwiseBinaryOp.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2008-03-08 19:02:24 +0000
committerGravatar Gael Guennebaud <g.gael@free.fr>2008-03-08 19:02:24 +0000
commit721626dfc5cab61ded1a26357b6c3dbb33763dc0 (patch)
treeb0ca850c64a5bfccdd300cb49baf2e469640d276 /Eigen/src/Core/CwiseBinaryOp.h
parent138aad0ed03cb9045b1f74ce52f0e47ce02966c8 (diff)
* 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.
Diffstat (limited to 'Eigen/src/Core/CwiseBinaryOp.h')
-rw-r--r--Eigen/src/Core/CwiseBinaryOp.h26
1 files changed, 15 insertions, 11 deletions
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<typename Scalar> 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<typename Scalar> 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<typename Scalar> 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<typename Scalar, typename Derived1, typename Derived2>
-const CwiseBinaryOp<CwiseDifferenceOp, Derived1, Derived2>
+const CwiseBinaryOp<ScalarDifferenceOp, Derived1, Derived2>
operator-(const MatrixBase<Scalar, Derived1> &mat1, const MatrixBase<Scalar, Derived2> &mat2)
{
- return CwiseBinaryOp<CwiseDifferenceOp, Derived1, Derived2>(mat1.asArg(), mat2.asArg());
+ return CwiseBinaryOp<ScalarDifferenceOp, Derived1, Derived2>(mat1.asArg(), mat2.asArg());
}
/** replaces \c *this by \c *this - \a other.
@@ -154,10 +158,10 @@ MatrixBase<Scalar, Derived>::operator-=(const MatrixBase<Scalar, OtherDerived> &
* \sa class CwiseBinaryOp, MatrixBase::operator+=()
*/
template<typename Scalar, typename Derived1, typename Derived2>
-const CwiseBinaryOp<CwiseSumOp, Derived1, Derived2>
+const CwiseBinaryOp<ScalarSumOp, Derived1, Derived2>
operator+(const MatrixBase<Scalar, Derived1> &mat1, const MatrixBase<Scalar, Derived2> &mat2)
{
- return CwiseBinaryOp<CwiseSumOp, Derived1, Derived2>(mat1.asArg(), mat2.asArg());
+ return CwiseBinaryOp<ScalarSumOp, Derived1, Derived2>(mat1.asArg(), mat2.asArg());
}
/** replaces \c *this by \c *this + \a other.
@@ -203,7 +207,7 @@ MatrixBase<Scalar, Derived>::cwiseQuotient(const MatrixBase<Scalar, OtherDerived
*
* The template parameter \a CustomBinaryOp is the type of the functor
* of the custom operator (see class CwiseBinaryOp for an example)
- *
+ *
* \sa class CwiseBinaryOp, MatrixBase::operator+, MatrixBase::operator-, MatrixBase::cwiseProduct, MatrixBase::cwiseQuotient
*/
template<typename Scalar, typename Derived>