diff options
author | Deanna Hood <deanna.m.hood@gmail.com> | 2015-03-17 08:29:57 +1000 |
---|---|---|
committer | Deanna Hood <deanna.m.hood@gmail.com> | 2015-03-17 08:29:57 +1000 |
commit | 1c78d6f2a6c7be509c1a190e1cfe42bce1916230 (patch) | |
tree | 91f04484ebd760b0d5ff940e1e711ca260f2ce86 /Eigen/src/plugins/ArrayCwiseUnaryOps.h | |
parent | 85da0c22819dcab2b7d50802e4e40e1e781e2e8b (diff) |
Add boolean not operator (!) array support
Diffstat (limited to 'Eigen/src/plugins/ArrayCwiseUnaryOps.h')
-rw-r--r-- | Eigen/src/plugins/ArrayCwiseUnaryOps.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Eigen/src/plugins/ArrayCwiseUnaryOps.h b/Eigen/src/plugins/ArrayCwiseUnaryOps.h index 6e6c86401..1d5c9a6c1 100644 --- a/Eigen/src/plugins/ArrayCwiseUnaryOps.h +++ b/Eigen/src/plugins/ArrayCwiseUnaryOps.h @@ -5,6 +5,7 @@ typedef CwiseUnaryOp<internal::scalar_arg_op<Scalar>, const Derived> ArgReturnTy typedef CwiseUnaryOp<internal::scalar_abs2_op<Scalar>, const Derived> Abs2ReturnType; typedef CwiseUnaryOp<internal::scalar_sqrt_op<Scalar>, const Derived> SqrtReturnType; typedef CwiseUnaryOp<internal::scalar_inverse_op<Scalar>, const Derived> InverseReturnType; +typedef CwiseUnaryOp<internal::scalar_boolean_not_op<Scalar>, const Derived> BooleanNotReturnType; typedef CwiseUnaryOp<internal::scalar_exp_op<Scalar>, const Derived> ExpReturnType; typedef CwiseUnaryOp<internal::scalar_log_op<Scalar>, const Derived> LogReturnType; @@ -404,6 +405,25 @@ isFinite() const return IsFiniteReturnType(derived()); } +/** \returns an expression of the coefficient-wise ! operator of *this + * + * \warning this operator is for expression of bool only. + * + * Example: \include Cwise_boolean_not.cpp + * Output: \verbinclude Cwise_boolean_not.out + * + * \sa operator!=() + */ +EIGEN_DEVICE_FUNC +inline const BooleanNotReturnType +operator!() const +{ + EIGEN_STATIC_ASSERT((internal::is_same<bool,Scalar>::value), + THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_OF_BOOL); + return BooleanNotReturnType(derived()); +} + + #define EIGEN_MAKE_SCALAR_CWISE_UNARY_OP(METHOD_NAME,FUNCTOR) \ EIGEN_DEVICE_FUNC \ inline const CwiseUnaryOp<std::binder2nd<FUNCTOR<Scalar> >, const Derived> \ |