14#ifndef EIGEN_PARSED_BY_DOXYGEN
17using ConjugateReturnType =
18 std::conditional_t<NumTraits<Scalar>::IsComplex,
19 const CwiseUnaryOp<internal::scalar_conjugate_op<Scalar>,
const Derived>,
const Derived&>;
22 std::conditional_t<NumTraits<Scalar>::IsComplex,
23 const CwiseUnaryOp<internal::scalar_real_op<Scalar>,
const Derived>,
const Derived&>;
25using NonConstRealReturnType =
26 std::conditional_t<NumTraits<Scalar>::IsComplex, CwiseUnaryView<internal::scalar_real_ref_op<Scalar>, Derived>,
29using ImagReturnType = CwiseUnaryOp<internal::scalar_imag_op<Scalar>,
const Derived>;
33using NonConstImagReturnType =
34 std::conditional_t<NumTraits<Scalar>::IsComplex, CwiseUnaryView<internal::scalar_imag_ref_op<Scalar>, Derived>,
37using NegativeReturnType = CwiseUnaryOp<internal::scalar_opposite_op<Scalar>,
const Derived>;
45EIGEN_DOC_UNARY_ADDONS(
operator-, opposite)
47EIGEN_DEVICE_FUNC
constexpr inline const NegativeReturnType operator-()
const {
return NegativeReturnType(derived()); }
49template <
class NewType>
51 using Type =
typename internal::cast_return_type<
52 Derived,
const CwiseUnaryOp<internal::core_cast_op<Scalar, NewType>,
const Derived>>::type;
60EIGEN_DOC_UNARY_ADDONS(cast, conversion function)
64template <
typename NewType>
65EIGEN_DEVICE_FUNC
constexpr typename CastXpr<NewType>::Type cast()
const {
66 return typename CastXpr<NewType>::Type(derived());
71EIGEN_DOC_UNARY_ADDONS(conjugate, complex conjugate)
74EIGEN_DEVICE_FUNC
constexpr inline ConjugateReturnType conjugate()
const {
return ConjugateReturnType(derived()); }
78EIGEN_DOC_UNARY_ADDONS(conjugate, complex conjugate)
82EIGEN_DEVICE_FUNC
constexpr inline std::conditional_t<Cond, ConjugateReturnType, const Derived&> conjugateIf()
const {
83 typedef std::conditional_t<Cond, ConjugateReturnType, const Derived&> ReturnType;
84 return ReturnType(derived());
89EIGEN_DOC_UNARY_ADDONS(real, real part function)
92EIGEN_DEVICE_FUNC
constexpr inline RealReturnType real()
const {
return RealReturnType(derived()); }
96EIGEN_DOC_UNARY_ADDONS(imag, imaginary part function)
99EIGEN_DEVICE_FUNC
constexpr inline const ImagReturnType imag()
const {
return ImagReturnType(derived()); }
118EIGEN_DOC_UNARY_ADDONS(unaryExpr, unary function)
122template <
typename CustomUnaryOp>
123EIGEN_DEVICE_FUNC
constexpr inline const CwiseUnaryOp<CustomUnaryOp, const Derived> unaryExpr(
124 const CustomUnaryOp& func = CustomUnaryOp())
const {
125 return CwiseUnaryOp<CustomUnaryOp, const Derived>(derived(), func);
137EIGEN_DOC_UNARY_ADDONS(unaryViewExpr, unary function)
141template <
typename CustomViewOp>
142EIGEN_DEVICE_FUNC
constexpr inline const CwiseUnaryView<CustomViewOp, const Derived> unaryViewExpr(
143 const CustomViewOp& func = CustomViewOp())
const {
144 return CwiseUnaryView<CustomViewOp, const Derived>(derived(), func);
152EIGEN_DOC_UNARY_ADDONS(unaryViewExpr, unary function)
156template <
typename CustomViewOp>
157EIGEN_DEVICE_FUNC
constexpr inline CwiseUnaryView<CustomViewOp, Derived> unaryViewExpr(
158 const CustomViewOp& func = CustomViewOp()) {
159 return CwiseUnaryView<CustomViewOp, Derived>(derived(), func);
164EIGEN_DOC_UNARY_ADDONS(real, real part function)
167EIGEN_DEVICE_FUNC
constexpr inline NonConstRealReturnType real() {
return NonConstRealReturnType(derived()); }
173EIGEN_DOC_UNARY_ADDONS(imag, imaginary part function)
176EIGEN_DEVICE_FUNC
constexpr inline NonConstImagReturnType imag() {
return NonConstImagReturnType(derived()); }