10 #ifndef EIGEN_NULLARY_FUNCTORS_H 11 #define EIGEN_NULLARY_FUNCTORS_H 17 template<
typename Scalar>
20 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE scalar_constant_op(
const Scalar& other) : m_other(other) { }
21 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
const Scalar operator() ()
const {
return m_other; }
22 template<
typename PacketType>
23 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
const PacketType packetOp()
const {
return internal::pset1<PacketType>(m_other); }
26 template<
typename Scalar>
33 template<
typename IndexType>
34 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
const Scalar operator() (IndexType row, IndexType col)
const {
return row==col ? Scalar(1) : Scalar(0); }
36 template<
typename Scalar>
42 template <
typename Scalar,
typename Packet>
46 m_low(low), m_high(high), m_size1(num_steps==1 ? 1 : num_steps-1), m_step(num_steps==1 ? Scalar() : (high-low)/Scalar(num_steps-1)),
47 m_interPacket(plset<Packet>(0)),
48 m_flip(numext::abs(high)<numext::abs(low))
51 template<
typename IndexType>
52 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
const Scalar operator() (IndexType i)
const {
54 return (i==0)? m_low : (m_high - (m_size1-i)*m_step);
56 return (i==m_size1)? m_high : (m_low + i*m_step);
59 template<
typename IndexType>
60 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
const Packet packetOp(IndexType i)
const 66 Packet pi = padd(pset1<Packet>(Scalar(i-m_size1)),m_interPacket);
67 Packet res = padd(pset1<Packet>(m_high), pmul(pset1<Packet>(m_step), pi));
69 res = pinsertfirst(res, m_low);
74 Packet pi = padd(pset1<Packet>(Scalar(i)),m_interPacket);
75 Packet res = padd(pset1<Packet>(m_low), pmul(pset1<Packet>(m_step), pi));
77 res = pinsertlast(res, m_high);
86 const Packet m_interPacket;
90 template <
typename Scalar,
typename Packet>
95 m_multiplier((high-low)/convert_index<Scalar>(num_steps<=1 ? 1 : num_steps-1)),
96 m_divisor(convert_index<Scalar>(num_steps+high-low)/(high-low+1)),
97 m_use_divisor((high+1)<(low+num_steps))
100 template<
typename IndexType>
101 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
102 const Scalar operator() (IndexType i)
const 104 if(m_use_divisor)
return m_low + convert_index<Scalar>(i)/m_divisor;
105 else return m_low + convert_index<Scalar>(i)*m_multiplier;
109 const Scalar m_multiplier;
110 const Scalar m_divisor;
111 const bool m_use_divisor;
130 template <
typename Scalar,
typename PacketType>
struct linspaced_op 133 : impl((num_steps==1 ? high : low),high,num_steps)
136 template<
typename IndexType>
137 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
const Scalar operator() (IndexType i)
const {
return impl(i); }
139 template<
typename Packet,
typename IndexType>
140 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
const Packet packetOp(IndexType i)
const {
return impl.packetOp(i); }
155 #if !( (EIGEN_COMP_MSVC>1600) || (EIGEN_GNUC_AT_LEAST(4,8)) || (EIGEN_COMP_ICC>=1600)) 156 template<
typename Scalar,
typename IndexType>
158 template<
typename Scalar,
typename IndexType>
160 template<
typename Scalar,
typename IndexType>
163 template<
typename Scalar,
typename IndexType>
165 template<
typename Scalar,
typename IndexType>
167 template<
typename Scalar,
typename IndexType>
170 template<
typename Scalar,
typename PacketType,
typename IndexType>
172 template<
typename Scalar,
typename PacketType,
typename IndexType>
174 template<
typename Scalar,
typename PacketType,
typename IndexType>
177 template<
typename Scalar,
typename IndexType>
179 template<
typename Scalar,
typename IndexType>
181 template<
typename Scalar,
typename IndexType>
189 #endif // EIGEN_NULLARY_FUNCTORS_H Definition: XprHelper.h:158
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:85
Definition: NullaryFunctors.h:151
Holds information about the various numeric (i.e.
Definition: NumTraits.h:150
Definition: GenericPacketMath.h:96
Definition: NullaryFunctors.h:40
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:33
Definition: PacketMath.h:48
Definition: BandTriangularSolver.h:13
Definition: NullaryFunctors.h:119
Definition: XprHelper.h:146
Definition: NullaryFunctors.h:31
Definition: TensorMeta.h:50
Definition: NullaryFunctors.h:18