Skip to content

Commit 2930659

Browse files
committed
import Eigen 3.3.4
1 parent 5a80a7e commit 2930659

35 files changed

+412
-221
lines changed

inst/include/Eigen/src/Core/Array.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,16 @@ class Array
231231
: Base(other)
232232
{ }
233233

234+
private:
235+
struct PrivateType {};
236+
public:
237+
234238
/** \sa MatrixBase::operator=(const EigenBase<OtherDerived>&) */
235239
template<typename OtherDerived>
236240
EIGEN_DEVICE_FUNC
237-
EIGEN_STRONG_INLINE Array(const EigenBase<OtherDerived> &other)
241+
EIGEN_STRONG_INLINE Array(const EigenBase<OtherDerived> &other,
242+
typename internal::enable_if<internal::is_convertible<typename OtherDerived::Scalar,Scalar>::value,
243+
PrivateType>::type = PrivateType())
238244
: Base(other.derived())
239245
{ }
240246

inst/include/Eigen/src/Core/ArrayBase.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ template<typename Derived> class ArrayBase
175175
*/
176176
template<typename Derived>
177177
template<typename OtherDerived>
178-
EIGEN_STRONG_INLINE Derived &
178+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived &
179179
ArrayBase<Derived>::operator-=(const ArrayBase<OtherDerived> &other)
180180
{
181181
call_assignment(derived(), other.derived(), internal::sub_assign_op<Scalar,typename OtherDerived::Scalar>());
@@ -188,7 +188,7 @@ ArrayBase<Derived>::operator-=(const ArrayBase<OtherDerived> &other)
188188
*/
189189
template<typename Derived>
190190
template<typename OtherDerived>
191-
EIGEN_STRONG_INLINE Derived &
191+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived &
192192
ArrayBase<Derived>::operator+=(const ArrayBase<OtherDerived>& other)
193193
{
194194
call_assignment(derived(), other.derived(), internal::add_assign_op<Scalar,typename OtherDerived::Scalar>());
@@ -201,7 +201,7 @@ ArrayBase<Derived>::operator+=(const ArrayBase<OtherDerived>& other)
201201
*/
202202
template<typename Derived>
203203
template<typename OtherDerived>
204-
EIGEN_STRONG_INLINE Derived &
204+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived &
205205
ArrayBase<Derived>::operator*=(const ArrayBase<OtherDerived>& other)
206206
{
207207
call_assignment(derived(), other.derived(), internal::mul_assign_op<Scalar,typename OtherDerived::Scalar>());
@@ -214,7 +214,7 @@ ArrayBase<Derived>::operator*=(const ArrayBase<OtherDerived>& other)
214214
*/
215215
template<typename Derived>
216216
template<typename OtherDerived>
217-
EIGEN_STRONG_INLINE Derived &
217+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived &
218218
ArrayBase<Derived>::operator/=(const ArrayBase<OtherDerived>& other)
219219
{
220220
call_assignment(derived(), other.derived(), internal::div_assign_op<Scalar,typename OtherDerived::Scalar>());

inst/include/Eigen/src/Core/ArrayWrapper.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ struct traits<ArrayWrapper<ExpressionType> >
3232
// Let's remove NestByRefBit
3333
enum {
3434
Flags0 = traits<typename remove_all<typename ExpressionType::Nested>::type >::Flags,
35-
Flags = Flags0 & ~NestByRefBit
35+
LvalueBitFlag = is_lvalue<ExpressionType>::value ? LvalueBit : 0,
36+
Flags = (Flags0 & ~(NestByRefBit | LvalueBit)) | LvalueBitFlag
3637
};
3738
};
3839
}
@@ -129,7 +130,8 @@ struct traits<MatrixWrapper<ExpressionType> >
129130
// Let's remove NestByRefBit
130131
enum {
131132
Flags0 = traits<typename remove_all<typename ExpressionType::Nested>::type >::Flags,
132-
Flags = Flags0 & ~NestByRefBit
133+
LvalueBitFlag = is_lvalue<ExpressionType>::value ? LvalueBit : 0,
134+
Flags = (Flags0 & ~(NestByRefBit | LvalueBit)) | LvalueBitFlag
133135
};
134136
};
135137
}

inst/include/Eigen/src/Core/CwiseNullaryOp.h

Lines changed: 40 additions & 40 deletions
Large diffs are not rendered by default.

inst/include/Eigen/src/Core/DenseBase.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ template<typename Derived> class DenseBase
296296
EIGEN_DEVICE_FUNC
297297
Derived& operator=(const ReturnByValue<OtherDerived>& func);
298298

299-
/** \ínternal
299+
/** \internal
300300
* Copies \a other into *this without evaluating other. \returns a reference to *this.
301301
* \deprecated */
302302
template<typename OtherDerived>
@@ -484,9 +484,9 @@ template<typename Derived> class DenseBase
484484
return derived().coeff(0,0);
485485
}
486486

487-
bool all() const;
488-
bool any() const;
489-
Index count() const;
487+
EIGEN_DEVICE_FUNC bool all() const;
488+
EIGEN_DEVICE_FUNC bool any() const;
489+
EIGEN_DEVICE_FUNC Index count() const;
490490

491491
typedef VectorwiseOp<Derived, Horizontal> RowwiseReturnType;
492492
typedef const VectorwiseOp<const Derived, Horizontal> ConstRowwiseReturnType;

inst/include/Eigen/src/Core/EigenBase.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
namespace Eigen {
1515

1616
/** \class EigenBase
17+
* \ingroup Core_Module
1718
*
1819
* Common base class for all classes T such that MatrixBase has an operator=(T) and a constructor MatrixBase(T).
1920
*
@@ -128,6 +129,7 @@ template<typename Derived> struct EigenBase
128129
*/
129130
template<typename Derived>
130131
template<typename OtherDerived>
132+
EIGEN_DEVICE_FUNC
131133
Derived& DenseBase<Derived>::operator=(const EigenBase<OtherDerived> &other)
132134
{
133135
call_assignment(derived(), other.derived());
@@ -136,6 +138,7 @@ Derived& DenseBase<Derived>::operator=(const EigenBase<OtherDerived> &other)
136138

137139
template<typename Derived>
138140
template<typename OtherDerived>
141+
EIGEN_DEVICE_FUNC
139142
Derived& DenseBase<Derived>::operator+=(const EigenBase<OtherDerived> &other)
140143
{
141144
call_assignment(derived(), other.derived(), internal::add_assign_op<Scalar,typename OtherDerived::Scalar>());
@@ -144,6 +147,7 @@ Derived& DenseBase<Derived>::operator+=(const EigenBase<OtherDerived> &other)
144147

145148
template<typename Derived>
146149
template<typename OtherDerived>
150+
EIGEN_DEVICE_FUNC
147151
Derived& DenseBase<Derived>::operator-=(const EigenBase<OtherDerived> &other)
148152
{
149153
call_assignment(derived(), other.derived(), internal::sub_assign_op<Scalar,typename OtherDerived::Scalar>());

inst/include/Eigen/src/Core/GenericPacketMath.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ pload1(const typename unpacket_traits<Packet>::type *a) { return pset1<Packet>(
230230
* duplicated to form: {from[0],from[0],from[1],from[1],from[2],from[2],from[3],from[3]}
231231
* Currently, this function is only used for scalar * complex products.
232232
*/
233-
template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
233+
template<typename Packet> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet
234234
ploaddup(const typename unpacket_traits<Packet>::type* from) { return *from; }
235235

236236
/** \internal \returns a packet with elements of \a *from quadrupled.
@@ -278,7 +278,7 @@ inline void pbroadcast2(const typename unpacket_traits<Packet>::type *a,
278278
}
279279

280280
/** \internal \brief Returns a packet with coefficients (a,a+1,...,a+packet_size-1). */
281-
template<typename Packet> inline Packet
281+
template<typename Packet> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet
282282
plset(const typename unpacket_traits<Packet>::type& a) { return a; }
283283

284284
/** \internal copy the packet \a from to \a *to, \a to must be 16 bytes aligned */
@@ -482,7 +482,7 @@ EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void pstoret(Scalar* to, const Packet& fro
482482
* by the current computation.
483483
*/
484484
template<typename Packet, int LoadMode>
485-
inline Packet ploadt_ro(const typename unpacket_traits<Packet>::type* from)
485+
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet ploadt_ro(const typename unpacket_traits<Packet>::type* from)
486486
{
487487
return ploadt<Packet, LoadMode>(from);
488488
}

inst/include/Eigen/src/Core/MathFunctions.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1061,11 +1061,24 @@ double log(const double &x) { return ::log(x); }
10611061

10621062
template<typename T>
10631063
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
1064-
typename NumTraits<T>::Real abs(const T &x) {
1064+
typename internal::enable_if<NumTraits<T>::IsSigned || NumTraits<T>::IsComplex,typename NumTraits<T>::Real>::type
1065+
abs(const T &x) {
10651066
EIGEN_USING_STD_MATH(abs);
10661067
return abs(x);
10671068
}
10681069

1070+
template<typename T>
1071+
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
1072+
typename internal::enable_if<!(NumTraits<T>::IsSigned || NumTraits<T>::IsComplex),typename NumTraits<T>::Real>::type
1073+
abs(const T &x) {
1074+
return x;
1075+
}
1076+
1077+
#if defined(__SYCL_DEVICE_ONLY__)
1078+
EIGEN_ALWAYS_INLINE float abs(float x) { return cl::sycl::fabs(x); }
1079+
EIGEN_ALWAYS_INLINE double abs(double x) { return cl::sycl::fabs(x); }
1080+
#endif // defined(__SYCL_DEVICE_ONLY__)
1081+
10691082
#ifdef __CUDACC__
10701083
template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
10711084
float abs(const float &x) { return ::fabsf(x); }

inst/include/Eigen/src/Core/MatrixBase.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,15 +294,15 @@ template<typename Derived> class MatrixBase
294294
* fuzzy comparison such as isApprox()
295295
* \sa isApprox(), operator!= */
296296
template<typename OtherDerived>
297-
inline bool operator==(const MatrixBase<OtherDerived>& other) const
297+
EIGEN_DEVICE_FUNC inline bool operator==(const MatrixBase<OtherDerived>& other) const
298298
{ return cwiseEqual(other).all(); }
299299

300300
/** \returns true if at least one pair of coefficients of \c *this and \a other are not exactly equal to each other.
301301
* \warning When using floating point scalar values you probably should rather use a
302302
* fuzzy comparison such as isApprox()
303303
* \sa isApprox(), operator== */
304304
template<typename OtherDerived>
305-
inline bool operator!=(const MatrixBase<OtherDerived>& other) const
305+
EIGEN_DEVICE_FUNC inline bool operator!=(const MatrixBase<OtherDerived>& other) const
306306
{ return cwiseNotEqual(other).any(); }
307307

308308
NoAlias<Derived,Eigen::MatrixBase > noalias();

inst/include/Eigen/src/Core/NumTraits.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@ struct NumTraits<Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols> >
215215
static inline RealScalar epsilon() { return NumTraits<RealScalar>::epsilon(); }
216216
EIGEN_DEVICE_FUNC
217217
static inline RealScalar dummy_precision() { return NumTraits<RealScalar>::dummy_precision(); }
218+
219+
static inline int digits10() { return NumTraits<Scalar>::digits10(); }
218220
};
219221

220222
template<> struct NumTraits<std::string>

0 commit comments

Comments
 (0)