10 #ifndef EIGEN_SPARSE_CWISE_UNARY_OP_H
11 #define EIGEN_SPARSE_CWISE_UNARY_OP_H
17 template<
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;
48 template<
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;
72 template<
typename ViewOp,
typename ArgType>
83 Flags = XprType::Flags
89 EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
95 const ViewOp m_functor;
99 template<
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;
124 template<
typename Derived>
125 EIGEN_STRONG_INLINE Derived&
130 for (
Index j=0; j<outerSize(); ++j)
131 for (EvalIterator i(thisEval,j); i; ++i)
132 i.valueRef() *= other;
136 template<
typename Derived>
137 EIGEN_STRONG_INLINE Derived&
142 for (
Index j=0; j<outerSize(); ++j)
143 for (EvalIterator i(thisEval,j); i; ++i)
144 i.valueRef() /= other;
150 #endif // EIGEN_SPARSE_CWISE_UNARY_OP_H