added scalar_sign_op (both real,complex)

This commit is contained in:
Mark Borgerding
2015-11-24 17:15:07 -05:00
parent 44848ac39b
commit 7ddcf97da7
7 changed files with 80 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ typedef CwiseUnaryOp<internal::scalar_abs_op<Scalar>, const Derived> AbsReturnTy
typedef CwiseUnaryOp<internal::scalar_arg_op<Scalar>, const Derived> ArgReturnType;
typedef CwiseUnaryOp<internal::scalar_abs2_op<Scalar>, const Derived> Abs2ReturnType;
typedef CwiseUnaryOp<internal::scalar_sqrt_op<Scalar>, const Derived> SqrtReturnType;
typedef CwiseUnaryOp<internal::scalar_sign_op<Scalar>, const Derived> SignReturnType;
typedef CwiseUnaryOp<internal::scalar_inverse_op<Scalar>, const Derived> InverseReturnType;
typedef CwiseUnaryOp<internal::scalar_boolean_not_op<Scalar>, const Derived> BooleanNotReturnType;
@@ -138,6 +139,24 @@ sqrt() const
return SqrtReturnType(derived());
}
/** \returns an expression of the coefficient-wise signum of *this.
*
* This function computes the coefficient-wise signum. The function MatrixBase::sign() in the
* unsupported module MatrixFunctions computes the matrix square root.
*
* Example: \include Cwise_sign.cpp
* Output: \verbinclude Cwise_sign.out
*
* \sa pow(), square()
*/
EIGEN_DEVICE_FUNC
inline const SignReturnType
sign() const
{
return SignReturnType(derived());
}
/** \returns an expression of the coefficient-wise cosine of *this.
*
* This function computes the coefficient-wise cosine. The function MatrixBase::cos() in the

View File

@@ -14,6 +14,7 @@
typedef CwiseUnaryOp<internal::scalar_abs_op<Scalar>, const Derived> CwiseAbsReturnType;
typedef CwiseUnaryOp<internal::scalar_abs2_op<Scalar>, const Derived> CwiseAbs2ReturnType;
typedef CwiseUnaryOp<internal::scalar_sqrt_op<Scalar>, const Derived> CwiseSqrtReturnType;
typedef CwiseUnaryOp<internal::scalar_sign_op<Scalar>, const Derived> CwiseSignReturnType;
typedef CwiseUnaryOp<internal::scalar_inverse_op<Scalar>, const Derived> CwiseInverseReturnType;
/** \returns an expression of the coefficient-wise absolute value of \c *this
@@ -49,6 +50,17 @@ EIGEN_DEVICE_FUNC
inline const CwiseSqrtReturnType
cwiseSqrt() const { return CwiseSqrtReturnType(derived()); }
/** \returns an expression of the coefficient-wise signum of *this.
*
* Example: \include MatrixBase_cwiseSign.cpp
* Output: \verbinclude MatrixBase_cwiseSign.out
*
*/
EIGEN_DEVICE_FUNC
inline const CwiseSignReturnType
cwiseSign() const { return CwiseSignReturnType(derived()); }
/** \returns an expression of the coefficient-wise inverse of *this.
*
* Example: \include MatrixBase_cwiseInverse.cpp