10#ifndef EIGEN_SPARSE_CWISE_UNARY_OP_H
11#define EIGEN_SPARSE_CWISE_UNARY_OP_H
17template<
typename UnaryOp,
typename ArgType>
28 Flags = XprType::Flags
34 EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
37 inline Index nonZerosEstimate()
const {
38 return m_argImpl.nonZerosEstimate();
44 const UnaryOp m_functor;
48template<
typename UnaryOp,
typename ArgType>
50 :
public unary_evaluator<CwiseUnaryOp<UnaryOp,ArgType>, IteratorBased>::EvalIterator
53 typedef typename XprType::Scalar Scalar;
58 : Base(unaryOp.m_argImpl,outer), m_functor(unaryOp.m_functor)
62 { Base::operator++();
return *
this; }
64 EIGEN_STRONG_INLINE Scalar value()
const {
return m_functor(Base::value()); }
67 const UnaryOp m_functor;
72template<
typename ViewOp,
typename ArgType>
83 Flags = XprType::Flags
89 EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
95 const ViewOp m_functor;
99template<
typename ViewOp,
typename ArgType>
101 :
public unary_evaluator<CwiseUnaryView<ViewOp,ArgType>, IteratorBased>::EvalIterator
104 typedef typename XprType::Scalar Scalar;
109 : Base(unaryOp.m_argImpl,outer), m_functor(unaryOp.m_functor)
113 { Base::operator++();
return *
this; }
115 EIGEN_STRONG_INLINE Scalar value()
const {
return m_functor(Base::value()); }
116 EIGEN_STRONG_INLINE Scalar& valueRef() {
return m_functor(Base::valueRef()); }
119 const ViewOp m_functor;
124template<
typename Derived>
125EIGEN_STRONG_INLINE Derived&
130 for (
Index j=0; j<outerSize(); ++j)
131 for (EvalIterator i(thisEval,j); i; ++i)
132 i.valueRef() *= other;
136template<
typename Derived>
137EIGEN_STRONG_INLINE Derived&
142 for (
Index j=0; j<outerSize(); ++j)
143 for (EvalIterator i(thisEval,j); i; ++i)
144 i.valueRef() /= other;
Generic expression where a coefficient-wise unary operator is applied to an expression.
Definition CwiseUnaryOp.h:56
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const UnaryOp & functor() const
Definition CwiseUnaryOp.h:75
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const internal::remove_all< XprTypeNested >::type & nestedExpression() const
Definition CwiseUnaryOp.h:80
Generic lvalue expression of a coefficient-wise unary operator of a matrix or a vector.
Definition CwiseUnaryView.h:59
EIGEN_DEVICE_FUNC const internal::remove_all< MatrixTypeNested >::type & nestedExpression() const
Definition CwiseUnaryView.h:82
EIGEN_DEVICE_FUNC const ViewOp & functor() const
Definition CwiseUnaryView.h:78
An InnerIterator allows to loop over the element of any matrix expression.
Definition CoreIterators.h:34
Base class of any sparse matrices or sparse expressions.
Definition SparseMatrixBase.h:28
Namespace containing all symbols from the Eigen library.
Definition common.h:81
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:74
Definition Constants.h:545
Definition CoreEvaluators.h:111
Definition CoreEvaluators.h:91
Definition XprHelper.h:176
Definition CoreEvaluators.h:65