[upstream_utils] Upgrade to Eigen 5.0.1 (#8428)

This commit is contained in:
Tyler Veness
2025-11-27 17:29:44 -08:00
committed by GitHub
parent c9b989ac6a
commit a802855e0c
21 changed files with 199 additions and 160 deletions

View File

@@ -154,7 +154,7 @@ def copy_upstream_src(wpilib_root: Path):
def main():
name = "eigen"
url = "https://gitlab.com/libeigen/eigen.git"
tag = "5.0.0"
tag = "5.0.1"
eigen = Lib(name, url, tag, copy_upstream_src)
eigen.main()

View File

@@ -106,6 +106,11 @@
#include <thread>
#endif
// for __cpp_lib feature test macros
#if defined(__has_include) && __has_include(<version>)
#include <version>
#endif
// for std::bit_cast()
#if defined(__cpp_lib_bit_cast) && __cpp_lib_bit_cast >= 201806L
#include <bit>

View File

@@ -6,9 +6,9 @@
// As of Eigen3 5.0.0, we have moved to Semantic Versioning (semver.org).
#define EIGEN_MAJOR_VERSION 5
#define EIGEN_MINOR_VERSION 0
#define EIGEN_PATCH_VERSION 0
#define EIGEN_PATCH_VERSION 1
#define EIGEN_PRERELEASE_VERSION ""
#define EIGEN_BUILD_VERSION ""
#define EIGEN_VERSION_STRING "5.0.0"
#define EIGEN_VERSION_STRING "5.0.1"
#endif // EIGEN_VERSION_H

View File

@@ -94,7 +94,7 @@ class CwiseNullaryOp : public internal::dense_xpr_base<CwiseNullaryOp<NullaryOp,
* the returned matrix. Must be compatible with this MatrixBase type.
*
* This variant is meant to be used for dynamic-size matrix types. For fixed-size types,
* it is redundant to pass \a rows and \a cols as arguments, so Zero() should be used
* it is redundant to pass \a rows and \a cols as arguments, so NullaryExpr(const CustomNullaryOp&) should be used
* instead.
*
* The template parameter \a CustomNullaryOp is the type of the functor.
@@ -121,7 +121,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
* \only_for_vectors
*
* This variant is meant to be used for dynamic-size vector types. For fixed-size types,
* it is redundant to pass \a size as argument, so Zero() should be used
* it is redundant to pass \a size as argument, so NullaryExpr(const CustomNullaryOp&) should be used
* instead.
*
* The template parameter \a CustomNullaryOp is the type of the functor.
@@ -174,7 +174,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
* the returned matrix. Must be compatible with this DenseBase type.
*
* This variant is meant to be used for dynamic-size matrix types. For fixed-size types,
* it is redundant to pass \a rows and \a cols as arguments, so Zero() should be used
* it is redundant to pass \a rows and \a cols as arguments, so Constant(const Scalar&) should be used
* instead.
*
* The template parameter \a CustomNullaryOp is the type of the functor.
@@ -195,7 +195,7 @@ DenseBase<Derived>::Constant(Index rows, Index cols, const Scalar& value) {
* \only_for_vectors
*
* This variant is meant to be used for dynamic-size vector types. For fixed-size types,
* it is redundant to pass \a size as argument, so Zero() should be used
* it is redundant to pass \a size as argument, so Constant(const Scalar&) should be used
* instead.
*
* The template parameter \a CustomNullaryOp is the type of the functor.

View File

@@ -65,7 +65,8 @@ struct plain_array {
template <typename T, int Size, int MatrixOrArrayOptions>
struct plain_array<T, Size, MatrixOrArrayOptions, 0> {
T array[Size];
// on some 32-bit platforms, stack-allocated arrays are aligned to 4 bytes, not the preferred alignment of T
EIGEN_ALIGN_TO_BOUNDARY(alignof(T)) T array[Size];
#if defined(EIGEN_NO_DEBUG) || defined(EIGEN_TESTING_PLAINOBJECT_CTOR)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr plain_array() = default;
#else
@@ -73,12 +74,6 @@ struct plain_array<T, Size, MatrixOrArrayOptions, 0> {
#endif
};
template <typename T, int MatrixOrArrayOptions, int Alignment>
struct plain_array<T, 0, MatrixOrArrayOptions, Alignment> {
T array[1];
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr plain_array() = default;
};
template <typename T, int Size, int Options, int Alignment>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void swap_plain_array(plain_array<T, Size, Options, Alignment>& a,
plain_array<T, Size, Options, Alignment>& b,

View File

@@ -115,17 +115,15 @@ struct eigen_zero_impl<Xpr, /*use_memset*/ false> {
template <typename Xpr>
struct eigen_zero_impl<Xpr, /*use_memset*/ true> {
using Scalar = typename Xpr::Scalar;
static constexpr size_t max_bytes = (std::numeric_limits<std::ptrdiff_t>::max)();
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Xpr& dst) {
const size_t num_bytes = dst.size() * sizeof(Scalar);
if (num_bytes == 0) return;
const std::ptrdiff_t num_bytes = dst.size() * static_cast<std::ptrdiff_t>(sizeof(Scalar));
if (num_bytes <= 0) return;
void* dst_ptr = static_cast<void*>(dst.data());
#ifndef EIGEN_NO_DEBUG
if (num_bytes > max_bytes) throw_std_bad_alloc();
eigen_assert((dst_ptr != nullptr) && "null pointer dereference error!");
#endif
EIGEN_USING_STD(memset);
memset(dst_ptr, 0, num_bytes);
memset(dst_ptr, 0, static_cast<std::size_t>(num_bytes));
}
template <typename SrcXpr>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Xpr& dst, const SrcXpr& src) {

View File

@@ -211,8 +211,14 @@ struct scalar_inner_product_op {
static constexpr bool PacketAccess = false;
};
// Partial specialization for packet access if and only if
// LhsScalar == RhsScalar == ScalarBinaryOpTraits<LhsScalar, RhsScalar>::ReturnType.
template <typename Scalar, bool Conj>
struct scalar_inner_product_op<Scalar, Scalar, Conj> {
struct scalar_inner_product_op<
Scalar,
typename std::enable_if<internal::is_same<typename ScalarBinaryOpTraits<Scalar, Scalar>::ReturnType, Scalar>::value,
Scalar>::type,
Conj> {
using result_type = Scalar;
using conj_helper = conditional_conj<Scalar, Conj>;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar coeff(const Scalar& a, const Scalar& b) const {

View File

@@ -1004,8 +1004,7 @@ struct madd_impl {
}
};
// Use FMA if there is a single CPU instruction.
#ifdef EIGEN_VECTORIZE_FMA
#if EIGEN_SCALAR_MADD_USE_FMA
template <typename Scalar>
struct madd_impl<Scalar, std::enable_if_t<has_fma<Scalar>::value>> {
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run(const Scalar& x, const Scalar& y, const Scalar& z) {
@@ -1927,7 +1926,6 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar arithmetic_shift_right(const Scalar
return bit_cast<Scalar, SignedScalar>(bit_cast<SignedScalar, Scalar>(a) >> n);
}
// Otherwise, rely on template implementation.
template <typename Scalar>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar fma(const Scalar& x, const Scalar& y, const Scalar& z) {
return internal::fma_impl<Scalar>::run(x, y, z);

View File

@@ -109,6 +109,9 @@ class PermutationBase : public EigenBase<Derived> {
*/
DenseMatrixType toDenseMatrix() const { return derived(); }
/** \returns the plain matrix representation of the permutation. */
DenseMatrixType eval() const { return toDenseMatrix(); }
/** const version of indices(). */
const IndicesType& indices() const { return derived().indices(); }
/** \returns a reference to the stored array representing the permutation. */

View File

@@ -2831,7 +2831,7 @@ inline __m128i segment_mask_4x8(Index begin, Index count) {
mask <<= CHAR_BIT * count;
mask--;
mask <<= CHAR_BIT * begin;
#if defined(_WIN32) && !defined(_WIN64)
#if !EIGEN_ARCH_x86_64
return _mm_loadl_epi64(reinterpret_cast<const __m128i*>(&mask));
#else
return _mm_cvtsi64_si128(mask);
@@ -2847,7 +2847,7 @@ inline __m128i segment_mask_8x8(Index begin, Index count) {
mask <<= (CHAR_BIT / 2) * count;
mask--;
mask <<= CHAR_BIT * begin;
#if defined(_WIN32) && !defined(_WIN64)
#if !EIGEN_ARCH_x86_64
return _mm_loadl_epi64(reinterpret_cast<const __m128i*>(&mask));
#else
return _mm_cvtsi64_si128(mask);

View File

@@ -240,8 +240,8 @@ EIGEN_STRONG_INLINE Packet4d pcast<Packet4l, Packet4d>(const Packet4l& a) {
#if defined(EIGEN_VECTORIZE_AVX512DQ) && defined(EIGEN_VECTORIZE_AVS512VL)
return _mm256_cvtepi64_pd(a);
#else
EIGEN_ALIGN16 int64_t aux[4];
pstore(aux, a);
int64_t aux[4];
pstoreu(aux, a);
return _mm256_set_pd(static_cast<double>(aux[3]), static_cast<double>(aux[2]), static_cast<double>(aux[1]),
static_cast<double>(aux[0]));
#endif

View File

@@ -48,7 +48,7 @@ struct Packet2cf {
};
template <>
struct packet_traits<std::complex<float> > : default_packet_traits {
struct packet_traits<std::complex<float>> : default_packet_traits {
typedef Packet2cf type;
typedef Packet1cf half;
enum {
@@ -280,13 +280,13 @@ EIGEN_STRONG_INLINE Packet2cf pandnot<Packet2cf>(const Packet2cf& a, const Packe
template <>
EIGEN_STRONG_INLINE Packet1cf pload<Packet1cf>(const std::complex<float>* from) {
EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet1cf>::alignment);
EIGEN_DEBUG_ALIGNED_LOAD return Packet1cf(pload<Packet2f>((const float*)from));
EIGEN_DEBUG_ALIGNED_LOAD return Packet1cf(
pload<Packet2f>(assume_aligned<unpacket_traits<Packet1cf>::alignment>(reinterpret_cast<const float*>(from))));
}
template <>
EIGEN_STRONG_INLINE Packet2cf pload<Packet2cf>(const std::complex<float>* from) {
EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet2cf>::alignment);
EIGEN_DEBUG_ALIGNED_LOAD return Packet2cf(pload<Packet4f>(reinterpret_cast<const float*>(from)));
EIGEN_DEBUG_ALIGNED_LOAD return Packet2cf(
pload<Packet4f>(assume_aligned<unpacket_traits<Packet2cf>::alignment>(reinterpret_cast<const float*>(from))));
}
template <>
@@ -308,22 +308,22 @@ EIGEN_STRONG_INLINE Packet2cf ploaddup<Packet2cf>(const std::complex<float>* fro
}
template <>
EIGEN_STRONG_INLINE void pstore<std::complex<float> >(std::complex<float>* to, const Packet1cf& from) {
EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet1cf>::alignment);
EIGEN_DEBUG_ALIGNED_STORE pstore((float*)to, from.v);
EIGEN_STRONG_INLINE void pstore<std::complex<float>>(std::complex<float>* to, const Packet1cf& from) {
EIGEN_DEBUG_ALIGNED_STORE pstore(assume_aligned<unpacket_traits<Packet1cf>::alignment>(reinterpret_cast<float*>(to)),
from.v);
}
template <>
EIGEN_STRONG_INLINE void pstore<std::complex<float> >(std::complex<float>* to, const Packet2cf& from) {
EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet2cf>::alignment);
EIGEN_DEBUG_ALIGNED_STORE pstore(reinterpret_cast<float*>(to), from.v);
EIGEN_STRONG_INLINE void pstore<std::complex<float>>(std::complex<float>* to, const Packet2cf& from) {
EIGEN_DEBUG_ALIGNED_STORE pstore(assume_aligned<unpacket_traits<Packet2cf>::alignment>(reinterpret_cast<float*>(to)),
from.v);
}
template <>
EIGEN_STRONG_INLINE void pstoreu<std::complex<float> >(std::complex<float>* to, const Packet1cf& from) {
EIGEN_STRONG_INLINE void pstoreu<std::complex<float>>(std::complex<float>* to, const Packet1cf& from) {
EIGEN_DEBUG_UNALIGNED_STORE pstoreu((float*)to, from.v);
}
template <>
EIGEN_STRONG_INLINE void pstoreu<std::complex<float> >(std::complex<float>* to, const Packet2cf& from) {
EIGEN_STRONG_INLINE void pstoreu<std::complex<float>>(std::complex<float>* to, const Packet2cf& from) {
EIGEN_DEBUG_UNALIGNED_STORE pstoreu(reinterpret_cast<float*>(to), from.v);
}
@@ -356,7 +356,7 @@ EIGEN_DEVICE_FUNC inline void pscatter<std::complex<float>, Packet2cf>(std::comp
}
template <>
EIGEN_STRONG_INLINE void prefetch<std::complex<float> >(const std::complex<float>* addr) {
EIGEN_STRONG_INLINE void prefetch<std::complex<float>>(const std::complex<float>* addr) {
EIGEN_ARM_PREFETCH(reinterpret_cast<const float*>(addr));
}
@@ -501,7 +501,7 @@ struct Packet1cd {
};
template <>
struct packet_traits<std::complex<double> > : default_packet_traits {
struct packet_traits<std::complex<double>> : default_packet_traits {
typedef Packet1cd type;
typedef Packet1cd half;
enum {
@@ -531,8 +531,8 @@ struct unpacket_traits<Packet1cd> : neon_unpacket_default<Packet1cd, std::comple
template <>
EIGEN_STRONG_INLINE Packet1cd pload<Packet1cd>(const std::complex<double>* from) {
EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet1cd>::alignment);
EIGEN_DEBUG_ALIGNED_LOAD return Packet1cd(pload<Packet2d>(reinterpret_cast<const double*>(from)));
EIGEN_DEBUG_ALIGNED_LOAD return Packet1cd(
pload<Packet2d>(assume_aligned<unpacket_traits<Packet1cd>::alignment>(reinterpret_cast<const double*>(from))));
}
template <>
@@ -644,18 +644,18 @@ EIGEN_STRONG_INLINE Packet1cd ploaddup<Packet1cd>(const std::complex<double>* fr
}
template <>
EIGEN_STRONG_INLINE void pstore<std::complex<double> >(std::complex<double>* to, const Packet1cd& from) {
EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet1cd>::alignment);
EIGEN_DEBUG_ALIGNED_STORE pstore(reinterpret_cast<double*>(to), from.v);
EIGEN_STRONG_INLINE void pstore<std::complex<double>>(std::complex<double>* to, const Packet1cd& from) {
EIGEN_DEBUG_ALIGNED_STORE pstore(assume_aligned<unpacket_traits<Packet1cd>::alignment>(reinterpret_cast<double*>(to)),
from.v);
}
template <>
EIGEN_STRONG_INLINE void pstoreu<std::complex<double> >(std::complex<double>* to, const Packet1cd& from) {
EIGEN_STRONG_INLINE void pstoreu<std::complex<double>>(std::complex<double>* to, const Packet1cd& from) {
EIGEN_DEBUG_UNALIGNED_STORE pstoreu(reinterpret_cast<double*>(to), from.v);
}
template <>
EIGEN_STRONG_INLINE void prefetch<std::complex<double> >(const std::complex<double>* addr) {
EIGEN_STRONG_INLINE void prefetch<std::complex<double>>(const std::complex<double>* addr) {
EIGEN_ARM_PREFETCH(reinterpret_cast<const double*>(addr));
}
@@ -677,7 +677,7 @@ EIGEN_DEVICE_FUNC inline void pscatter<std::complex<double>, Packet1cd>(std::com
template <>
EIGEN_STRONG_INLINE std::complex<double> pfirst<Packet1cd>(const Packet1cd& a) {
EIGEN_ALIGN16 std::complex<double> res;
pstore<std::complex<double> >(&res, a);
pstore<std::complex<double>>(&res, a);
return res;
}

View File

@@ -2268,13 +2268,11 @@ EIGEN_STRONG_INLINE Packet2ul plogical_shift_left(Packet2ul a) {
template <>
EIGEN_STRONG_INLINE Packet2f pload<Packet2f>(const float* from) {
EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet2f>::alignment);
EIGEN_DEBUG_ALIGNED_LOAD return vld1_f32(from);
EIGEN_DEBUG_ALIGNED_LOAD return vld1_f32(assume_aligned<unpacket_traits<Packet2f>::alignment>(from));
}
template <>
EIGEN_STRONG_INLINE Packet4f pload<Packet4f>(const float* from) {
EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet4f>::alignment);
EIGEN_DEBUG_ALIGNED_LOAD return vld1q_f32(from);
EIGEN_DEBUG_ALIGNED_LOAD return vld1q_f32(assume_aligned<unpacket_traits<Packet4f>::alignment>(from));
}
template <>
EIGEN_STRONG_INLINE Packet4c pload<Packet4c>(const int8_t* from) {
@@ -2284,13 +2282,11 @@ EIGEN_STRONG_INLINE Packet4c pload<Packet4c>(const int8_t* from) {
}
template <>
EIGEN_STRONG_INLINE Packet8c pload<Packet8c>(const int8_t* from) {
EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet8c>::alignment);
EIGEN_DEBUG_ALIGNED_LOAD return vld1_s8(from);
EIGEN_DEBUG_ALIGNED_LOAD return vld1_s8(assume_aligned<unpacket_traits<Packet8c>::alignment>(from));
}
template <>
EIGEN_STRONG_INLINE Packet16c pload<Packet16c>(const int8_t* from) {
EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet16c>::alignment);
EIGEN_DEBUG_ALIGNED_LOAD return vld1q_s8(from);
EIGEN_DEBUG_ALIGNED_LOAD return vld1q_s8(assume_aligned<unpacket_traits<Packet16c>::alignment>(from));
}
template <>
EIGEN_STRONG_INLINE Packet4uc pload<Packet4uc>(const uint8_t* from) {
@@ -2300,63 +2296,51 @@ EIGEN_STRONG_INLINE Packet4uc pload<Packet4uc>(const uint8_t* from) {
}
template <>
EIGEN_STRONG_INLINE Packet8uc pload<Packet8uc>(const uint8_t* from) {
EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet8uc>::alignment);
EIGEN_DEBUG_ALIGNED_LOAD return vld1_u8(from);
EIGEN_DEBUG_ALIGNED_LOAD return vld1_u8(assume_aligned<unpacket_traits<Packet8uc>::alignment>(from));
}
template <>
EIGEN_STRONG_INLINE Packet16uc pload<Packet16uc>(const uint8_t* from) {
EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet16uc>::alignment);
EIGEN_DEBUG_ALIGNED_LOAD return vld1q_u8(from);
EIGEN_DEBUG_ALIGNED_LOAD return vld1q_u8(assume_aligned<unpacket_traits<Packet16uc>::alignment>(from));
}
template <>
EIGEN_STRONG_INLINE Packet4s pload<Packet4s>(const int16_t* from) {
EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet4s>::alignment);
EIGEN_DEBUG_ALIGNED_LOAD return vld1_s16(from);
EIGEN_DEBUG_ALIGNED_LOAD return vld1_s16(assume_aligned<unpacket_traits<Packet4s>::alignment>(from));
}
template <>
EIGEN_STRONG_INLINE Packet8s pload<Packet8s>(const int16_t* from) {
EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet8s>::alignment);
EIGEN_DEBUG_ALIGNED_LOAD return vld1q_s16(from);
EIGEN_DEBUG_ALIGNED_LOAD return vld1q_s16(assume_aligned<unpacket_traits<Packet8s>::alignment>(from));
}
template <>
EIGEN_STRONG_INLINE Packet4us pload<Packet4us>(const uint16_t* from) {
EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet4us>::alignment);
EIGEN_DEBUG_ALIGNED_LOAD return vld1_u16(from);
EIGEN_DEBUG_ALIGNED_LOAD return vld1_u16(assume_aligned<unpacket_traits<Packet4us>::alignment>(from));
}
template <>
EIGEN_STRONG_INLINE Packet8us pload<Packet8us>(const uint16_t* from) {
EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet8us>::alignment);
EIGEN_DEBUG_ALIGNED_LOAD return vld1q_u16(from);
EIGEN_DEBUG_ALIGNED_LOAD return vld1q_u16(assume_aligned<unpacket_traits<Packet8us>::alignment>(from));
}
template <>
EIGEN_STRONG_INLINE Packet2i pload<Packet2i>(const int32_t* from) {
EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet2i>::alignment);
EIGEN_DEBUG_ALIGNED_LOAD return vld1_s32(from);
EIGEN_DEBUG_ALIGNED_LOAD return vld1_s32(assume_aligned<unpacket_traits<Packet2i>::alignment>(from));
}
template <>
EIGEN_STRONG_INLINE Packet4i pload<Packet4i>(const int32_t* from) {
EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet4i>::alignment);
EIGEN_DEBUG_ALIGNED_LOAD return vld1q_s32(from);
EIGEN_DEBUG_ALIGNED_LOAD return vld1q_s32(assume_aligned<unpacket_traits<Packet4i>::alignment>(from));
}
template <>
EIGEN_STRONG_INLINE Packet2ui pload<Packet2ui>(const uint32_t* from) {
EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet2ui>::alignment);
EIGEN_DEBUG_ALIGNED_LOAD return vld1_u32(from);
EIGEN_DEBUG_ALIGNED_LOAD return vld1_u32(assume_aligned<unpacket_traits<Packet2ui>::alignment>(from));
}
template <>
EIGEN_STRONG_INLINE Packet4ui pload<Packet4ui>(const uint32_t* from) {
EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet4ui>::alignment);
EIGEN_DEBUG_ALIGNED_LOAD return vld1q_u32(from);
EIGEN_DEBUG_ALIGNED_LOAD return vld1q_u32(assume_aligned<unpacket_traits<Packet4ui>::alignment>(from));
}
template <>
EIGEN_STRONG_INLINE Packet2l pload<Packet2l>(const int64_t* from) {
EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet2l>::alignment);
EIGEN_DEBUG_ALIGNED_LOAD return vld1q_s64(from);
EIGEN_DEBUG_ALIGNED_LOAD return vld1q_s64(assume_aligned<unpacket_traits<Packet2l>::alignment>(from));
}
template <>
EIGEN_STRONG_INLINE Packet2ul pload<Packet2ul>(const uint64_t* from) {
EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet2ul>::alignment);
EIGEN_DEBUG_ALIGNED_LOAD return vld1q_u64(from);
EIGEN_DEBUG_ALIGNED_LOAD return vld1q_u64(assume_aligned<unpacket_traits<Packet2ul>::alignment>(from));
}
template <>
@@ -2580,13 +2564,11 @@ EIGEN_STRONG_INLINE Packet4ui ploadquad<Packet4ui>(const uint32_t* from) {
template <>
EIGEN_STRONG_INLINE void pstore<float>(float* to, const Packet2f& from) {
EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet2f>::alignment);
EIGEN_DEBUG_ALIGNED_STORE vst1_f32(to, from);
EIGEN_DEBUG_ALIGNED_STORE vst1_f32(assume_aligned<unpacket_traits<Packet2f>::alignment>(to), from);
}
template <>
EIGEN_STRONG_INLINE void pstore<float>(float* to, const Packet4f& from) {
EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet4f>::alignment);
EIGEN_DEBUG_ALIGNED_STORE vst1q_f32(to, from);
EIGEN_DEBUG_ALIGNED_STORE vst1q_f32(assume_aligned<unpacket_traits<Packet4f>::alignment>(to), from);
}
template <>
EIGEN_STRONG_INLINE void pstore<int8_t>(int8_t* to, const Packet4c& from) {
@@ -2594,13 +2576,11 @@ EIGEN_STRONG_INLINE void pstore<int8_t>(int8_t* to, const Packet4c& from) {
}
template <>
EIGEN_STRONG_INLINE void pstore<int8_t>(int8_t* to, const Packet8c& from) {
EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet8c>::alignment);
EIGEN_DEBUG_ALIGNED_STORE vst1_s8(to, from);
EIGEN_DEBUG_ALIGNED_STORE vst1_s8(assume_aligned<unpacket_traits<Packet8c>::alignment>(to), from);
}
template <>
EIGEN_STRONG_INLINE void pstore<int8_t>(int8_t* to, const Packet16c& from) {
EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet16c>::alignment);
EIGEN_DEBUG_ALIGNED_STORE vst1q_s8(to, from);
EIGEN_DEBUG_ALIGNED_STORE vst1q_s8(assume_aligned<unpacket_traits<Packet16c>::alignment>(to), from);
}
template <>
EIGEN_STRONG_INLINE void pstore<uint8_t>(uint8_t* to, const Packet4uc& from) {
@@ -2608,63 +2588,51 @@ EIGEN_STRONG_INLINE void pstore<uint8_t>(uint8_t* to, const Packet4uc& from) {
}
template <>
EIGEN_STRONG_INLINE void pstore<uint8_t>(uint8_t* to, const Packet8uc& from) {
EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet8uc>::alignment);
EIGEN_DEBUG_ALIGNED_STORE vst1_u8(to, from);
EIGEN_DEBUG_ALIGNED_STORE vst1_u8(assume_aligned<unpacket_traits<Packet8uc>::alignment>(to), from);
}
template <>
EIGEN_STRONG_INLINE void pstore<uint8_t>(uint8_t* to, const Packet16uc& from) {
EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet16uc>::alignment);
EIGEN_DEBUG_ALIGNED_STORE vst1q_u8(to, from);
EIGEN_DEBUG_ALIGNED_STORE vst1q_u8(assume_aligned<unpacket_traits<Packet16uc>::alignment>(to), from);
}
template <>
EIGEN_STRONG_INLINE void pstore<int16_t>(int16_t* to, const Packet4s& from) {
EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet4s>::alignment);
EIGEN_DEBUG_ALIGNED_STORE vst1_s16(to, from);
EIGEN_DEBUG_ALIGNED_STORE vst1_s16(assume_aligned<unpacket_traits<Packet4s>::alignment>(to), from);
}
template <>
EIGEN_STRONG_INLINE void pstore<int16_t>(int16_t* to, const Packet8s& from) {
EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet8s>::alignment);
EIGEN_DEBUG_ALIGNED_STORE vst1q_s16(to, from);
EIGEN_DEBUG_ALIGNED_STORE vst1q_s16(assume_aligned<unpacket_traits<Packet8s>::alignment>(to), from);
}
template <>
EIGEN_STRONG_INLINE void pstore<uint16_t>(uint16_t* to, const Packet4us& from) {
EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet4us>::alignment);
EIGEN_DEBUG_ALIGNED_STORE vst1_u16(to, from);
EIGEN_DEBUG_ALIGNED_STORE vst1_u16(assume_aligned<unpacket_traits<Packet4us>::alignment>(to), from);
}
template <>
EIGEN_STRONG_INLINE void pstore<uint16_t>(uint16_t* to, const Packet8us& from) {
EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet8us>::alignment);
EIGEN_DEBUG_ALIGNED_STORE vst1q_u16(to, from);
EIGEN_DEBUG_ALIGNED_STORE vst1q_u16(assume_aligned<unpacket_traits<Packet8us>::alignment>(to), from);
}
template <>
EIGEN_STRONG_INLINE void pstore<int32_t>(int32_t* to, const Packet2i& from) {
EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet2i>::alignment);
EIGEN_DEBUG_ALIGNED_STORE vst1_s32(to, from);
EIGEN_DEBUG_ALIGNED_STORE vst1_s32(assume_aligned<unpacket_traits<Packet2i>::alignment>(to), from);
}
template <>
EIGEN_STRONG_INLINE void pstore<int32_t>(int32_t* to, const Packet4i& from) {
EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet4i>::alignment);
EIGEN_DEBUG_ALIGNED_STORE vst1q_s32(to, from);
EIGEN_DEBUG_ALIGNED_STORE vst1q_s32(assume_aligned<unpacket_traits<Packet4i>::alignment>(to), from);
}
template <>
EIGEN_STRONG_INLINE void pstore<uint32_t>(uint32_t* to, const Packet2ui& from) {
EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet2ui>::alignment);
EIGEN_DEBUG_ALIGNED_STORE vst1_u32(to, from);
EIGEN_DEBUG_ALIGNED_STORE vst1_u32(assume_aligned<unpacket_traits<Packet2ui>::alignment>(to), from);
}
template <>
EIGEN_STRONG_INLINE void pstore<uint32_t>(uint32_t* to, const Packet4ui& from) {
EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet4ui>::alignment);
EIGEN_DEBUG_ALIGNED_STORE vst1q_u32(to, from);
EIGEN_DEBUG_ALIGNED_STORE vst1q_u32(assume_aligned<unpacket_traits<Packet4ui>::alignment>(to), from);
}
template <>
EIGEN_STRONG_INLINE void pstore<int64_t>(int64_t* to, const Packet2l& from) {
EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet2l>::alignment);
EIGEN_DEBUG_ALIGNED_STORE vst1q_s64(to, from);
EIGEN_DEBUG_ALIGNED_STORE vst1q_s64(assume_aligned<unpacket_traits<Packet2l>::alignment>(to), from);
}
template <>
EIGEN_STRONG_INLINE void pstore<uint64_t>(uint64_t* to, const Packet2ul& from) {
EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet2ul>::alignment);
EIGEN_DEBUG_ALIGNED_STORE vst1q_u64(to, from);
EIGEN_DEBUG_ALIGNED_STORE vst1q_u64(assume_aligned<unpacket_traits<Packet2ul>::alignment>(to), from);
}
template <>
@@ -4739,8 +4707,8 @@ EIGEN_STRONG_INLINE bfloat16 pfirst<Packet4bf>(const Packet4bf& from) {
template <>
EIGEN_STRONG_INLINE Packet4bf pload<Packet4bf>(const bfloat16* from) {
EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet4bf>::alignment);
return Packet4bf(pload<Packet4us>(reinterpret_cast<const uint16_t*>(from)));
return Packet4bf(
pload<Packet4us>(reinterpret_cast<const uint16_t*>(assume_aligned<unpacket_traits<Packet4bf>::alignment>(from))));
}
template <>
@@ -4750,8 +4718,8 @@ EIGEN_STRONG_INLINE Packet4bf ploadu<Packet4bf>(const bfloat16* from) {
template <>
EIGEN_STRONG_INLINE void pstore<bfloat16>(bfloat16* to, const Packet4bf& from) {
EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet4bf>::alignment);
EIGEN_DEBUG_ALIGNED_STORE vst1_u16(reinterpret_cast<uint16_t*>(to), from);
EIGEN_DEBUG_ALIGNED_STORE vst1_u16(
reinterpret_cast<uint16_t*>(assume_aligned<unpacket_traits<Packet4bf>::alignment>(to)), from);
}
template <>
@@ -5240,8 +5208,7 @@ EIGEN_STRONG_INLINE Packet2d pcmp_eq(const Packet2d& a, const Packet2d& b) {
template <>
EIGEN_STRONG_INLINE Packet2d pload<Packet2d>(const double* from) {
EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet2d>::alignment);
EIGEN_DEBUG_ALIGNED_LOAD return vld1q_f64(from);
EIGEN_DEBUG_ALIGNED_LOAD return vld1q_f64(assume_aligned<unpacket_traits<Packet2d>::alignment>(from));
}
template <>
@@ -5255,8 +5222,7 @@ EIGEN_STRONG_INLINE Packet2d ploaddup<Packet2d>(const double* from) {
}
template <>
EIGEN_STRONG_INLINE void pstore<double>(double* to, const Packet2d& from) {
EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet2d>::alignment);
EIGEN_DEBUG_ALIGNED_STORE vst1q_f64(to, from);
EIGEN_DEBUG_ALIGNED_STORE vst1q_f64(assume_aligned<unpacket_traits<Packet2d>::alignment>(to), from);
}
template <>
@@ -5784,14 +5750,14 @@ EIGEN_STRONG_INLINE Packet4hf pandnot<Packet4hf>(const Packet4hf& a, const Packe
template <>
EIGEN_STRONG_INLINE Packet8hf pload<Packet8hf>(const Eigen::half* from) {
EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet8hf>::alignment);
EIGEN_DEBUG_ALIGNED_LOAD return vld1q_f16(reinterpret_cast<const float16_t*>(from));
EIGEN_DEBUG_ALIGNED_LOAD return vld1q_f16(
reinterpret_cast<const float16_t*>(assume_aligned<unpacket_traits<Packet8hf>::alignment>(from)));
}
template <>
EIGEN_STRONG_INLINE Packet4hf pload<Packet4hf>(const Eigen::half* from) {
EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet4hf>::alignment);
EIGEN_DEBUG_ALIGNED_LOAD return vld1_f16(reinterpret_cast<const float16_t*>(from));
EIGEN_DEBUG_ALIGNED_LOAD return vld1_f16(
reinterpret_cast<const float16_t*>(assume_aligned<unpacket_traits<Packet4hf>::alignment>(from)));
}
template <>
@@ -5866,14 +5832,14 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet4hf pinsertlast(const Packet4hf& a,
template <>
EIGEN_STRONG_INLINE void pstore<Eigen::half>(Eigen::half* to, const Packet8hf& from) {
EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet8hf>::alignment);
EIGEN_DEBUG_ALIGNED_STORE vst1q_f16(reinterpret_cast<float16_t*>(to), from);
EIGEN_DEBUG_ALIGNED_STORE vst1q_f16(
reinterpret_cast<float16_t*>(assume_aligned<unpacket_traits<Packet8hf>::alignment>(to)), from);
}
template <>
EIGEN_STRONG_INLINE void pstore<Eigen::half>(Eigen::half* to, const Packet4hf& from) {
EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet4hf>::alignment);
EIGEN_DEBUG_ALIGNED_STORE vst1_f16(reinterpret_cast<float16_t*>(to), from);
EIGEN_DEBUG_ALIGNED_STORE vst1_f16(
reinterpret_cast<float16_t*>(assume_aligned<unpacket_traits<Packet4hf>::alignment>(to)), from);
}
template <>

View File

@@ -1679,9 +1679,9 @@ EIGEN_STRONG_INLINE Packet16b pgather<bool, Packet16b>(const bool* from, Index s
template <>
EIGEN_STRONG_INLINE void pscatter<float, Packet4f>(float* to, const Packet4f& from, Index stride) {
to[stride * 0] = pfirst(from);
to[stride * 1] = pfirst(_mm_shuffle_ps(from, from, 1));
to[stride * 2] = pfirst(_mm_shuffle_ps(from, from, 2));
to[stride * 3] = pfirst(_mm_shuffle_ps(from, from, 3));
to[stride * 1] = pfirst(Packet4f(_mm_shuffle_ps(from, from, 1)));
to[stride * 2] = pfirst(Packet4f(_mm_shuffle_ps(from, from, 2)));
to[stride * 3] = pfirst(Packet4f(_mm_shuffle_ps(from, from, 3)));
}
template <>
EIGEN_STRONG_INLINE void pscatter<double, Packet2d>(double* to, const Packet2d& from, Index stride) {

View File

@@ -52,6 +52,26 @@
#define EIGEN_STACK_ALLOCATION_LIMIT 131072
#endif
/* Specify whether to use std::fma for scalar multiply-add instructions.
*
* On machines that have FMA as a single instruction, this will generally
* improve precision without significant performance implications.
*
* Without a single instruction, performance has been found to be reduced 2-3x
* on Intel CPUs, and up to 30x for WASM.
*
* If unspecified, defaults to using FMA if hardware support is available.
* The default should be used in most cases to ensure consistency between
* vectorized and non-vectorized paths.
*/
#ifndef EIGEN_SCALAR_MADD_USE_FMA
#ifdef EIGEN_VECTORIZE_FMA
#define EIGEN_SCALAR_MADD_USE_FMA 1
#else
#define EIGEN_SCALAR_MADD_USE_FMA 0
#endif
#endif
//------------------------------------------------------------------------------------------
// Compiler identification, EIGEN_COMP_*
//------------------------------------------------------------------------------------------

View File

@@ -91,6 +91,9 @@ namespace internal {
EIGEN_DEVICE_FUNC inline void check_that_malloc_is_allowed() {
eigen_assert(false && "heap allocation is forbidden (EIGEN_NO_MALLOC is defined)");
}
EIGEN_DEVICE_FUNC inline void check_that_free_is_allowed() {
eigen_assert(false && "heap deallocation is forbidden (EIGEN_NO_MALLOC is defined)");
}
#elif defined EIGEN_RUNTIME_NO_MALLOC
EIGEN_DEVICE_FUNC inline bool is_malloc_allowed_impl(bool update, bool new_value = false) {
EIGEN_MALLOC_CHECK_THREAD_LOCAL static bool value = true;
@@ -101,10 +104,22 @@ EIGEN_DEVICE_FUNC inline bool is_malloc_allowed() { return is_malloc_allowed_imp
EIGEN_DEVICE_FUNC inline bool set_is_malloc_allowed(bool new_value) { return is_malloc_allowed_impl(true, new_value); }
EIGEN_DEVICE_FUNC inline void check_that_malloc_is_allowed() {
eigen_assert(is_malloc_allowed() &&
"heap allocation is forbidden (EIGEN_RUNTIME_NO_MALLOC is defined and g_is_malloc_allowed is false)");
"heap allocation is forbidden (EIGEN_RUNTIME_NO_MALLOC is defined and set_is_malloc_allowed is false)");
}
EIGEN_DEVICE_FUNC inline bool is_free_allowed_impl(bool update, bool new_value = false) {
EIGEN_MALLOC_CHECK_THREAD_LOCAL static bool value = true;
if (update == 1) value = new_value;
return value;
}
EIGEN_DEVICE_FUNC inline bool is_free_allowed() { return is_free_allowed_impl(false); }
EIGEN_DEVICE_FUNC inline bool set_is_free_allowed(bool new_value) { return is_free_allowed_impl(true, new_value); }
EIGEN_DEVICE_FUNC inline void check_that_free_is_allowed() {
eigen_assert(is_malloc_allowed() &&
"heap deallocation is forbidden (EIGEN_RUNTIME_NO_MALLOC is defined and set_is_free_allowed is false)");
}
#else
EIGEN_DEVICE_FUNC inline void check_that_malloc_is_allowed() {}
EIGEN_DEVICE_FUNC inline void check_that_free_is_allowed() {}
#endif
EIGEN_DEVICE_FUNC inline void throw_std_bad_alloc() {
@@ -161,7 +176,7 @@ EIGEN_DEVICE_FUNC inline void handmade_aligned_free(void* ptr) {
std::size_t offset = static_cast<std::size_t>(*(static_cast<uint8_t*>(ptr) - 1)) + 1;
void* original = static_cast<void*>(static_cast<uint8_t*>(ptr) - offset);
check_that_malloc_is_allowed();
check_that_free_is_allowed();
EIGEN_USING_STD(free)
free(original);
}
@@ -227,7 +242,7 @@ EIGEN_DEVICE_FUNC inline void aligned_free(void* ptr) {
#if (EIGEN_DEFAULT_ALIGN_BYTES == 0) || EIGEN_MALLOC_ALREADY_ALIGNED
if (ptr != nullptr) {
check_that_malloc_is_allowed();
check_that_free_is_allowed();
EIGEN_USING_STD(free)
free(ptr);
}
@@ -299,7 +314,7 @@ EIGEN_DEVICE_FUNC inline void conditional_aligned_free(void* ptr) {
template <>
EIGEN_DEVICE_FUNC inline void conditional_aligned_free<false>(void* ptr) {
if (ptr != nullptr) {
check_that_malloc_is_allowed();
check_that_free_is_allowed();
EIGEN_USING_STD(free)
free(ptr);
}
@@ -1339,19 +1354,28 @@ EIGEN_DEVICE_FUNC void destroy_at(T* p) {
}
#endif
/** \internal
* This informs the implementation that PTR is aligned to at least ALIGN_BYTES
*/
#ifndef EIGEN_ASSUME_ALIGNED
#if defined(__cpp_lib_assume_aligned) && (__cpp_lib_assume_aligned >= 201811L)
#define EIGEN_ASSUME_ALIGNED(PTR, ALIGN_BYTES) \
{ PTR = std::assume_aligned<8 * (ALIGN_BYTES)>(PTR); }
#elif EIGEN_HAS_BUILTIN(__builtin_assume_aligned)
#define EIGEN_ASSUME_ALIGNED(PTR, ALIGN_BYTES) \
{ PTR = static_cast<decltype(PTR)>(__builtin_assume_aligned(PTR, (ALIGN_BYTES))); }
#else
#define EIGEN_ASSUME_ALIGNED(PTR, ALIGN_BYTES) /* do nothing */
// FIXME(rmlarsen): Work around missing linker symbol with msan on ARM.
#if !defined(EIGEN_DONT_ASSUME_ALIGNED) && __has_feature(memory_sanitizer) && \
(EIGEN_ARCH_ARM || EIGEN_ARCH_ARM64)
#define EIGEN_DONT_ASSUME_ALIGNED
#endif
#if !defined(EIGEN_DONT_ASSUME_ALIGNED) && defined(__cpp_lib_assume_aligned) && (__cpp_lib_assume_aligned >= 201811L)
template <std::size_t N, typename T>
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC constexpr T* assume_aligned(T* ptr) {
return std::assume_aligned<N, T>(ptr);
}
#elif !defined(EIGEN_DONT_ASSUME_ALIGNED) && EIGEN_HAS_BUILTIN(__builtin_assume_aligned)
template <std::size_t N, typename T>
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC T* assume_aligned(T* ptr) {
return static_cast<T*>(__builtin_assume_aligned(ptr, N));
}
#else
template <std::size_t N, typename T>
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC constexpr T* assume_aligned(T* ptr) {
return ptr;
}
#endif
} // end namespace internal

View File

@@ -65,7 +65,6 @@ template <typename EssentialPart>
EIGEN_DEVICE_FUNC void MatrixBase<Derived>::makeHouseholder(EssentialPart& essential, Scalar& tau,
RealScalar& beta) const {
using numext::conj;
using numext::sqrt;
EIGEN_STATIC_ASSERT_VECTOR_ONLY(EssentialPart)
VectorBlock<const Derived, EssentialPart::SizeAtCompileTime> tail(derived(), 1, size() - 1);
@@ -79,7 +78,7 @@ EIGEN_DEVICE_FUNC void MatrixBase<Derived>::makeHouseholder(EssentialPart& essen
beta = numext::real(c0);
essential.setZero();
} else {
beta = sqrt(numext::abs2(c0) + tailSqNorm);
beta = numext::sqrt(numext::abs2(c0) + tailSqNorm);
if (numext::real(c0) >= RealScalar(0)) beta = -beta;
essential = tail / (c0 - beta);
tau = conj((beta - c0) / beta);

View File

@@ -571,6 +571,11 @@ class JacobiSVD : public SVDBase<JacobiSVD<MatrixType_, Options_> > {
compute_impl(matrix, internal::get_computation_options(Options));
}
template <typename Derived>
explicit JacobiSVD(const TriangularBase<Derived>& matrix) {
compute_impl(matrix, internal::get_computation_options(Options));
}
/** \brief Constructor performing the decomposition of given matrix using specified options
* for computing unitaries.
*
@@ -601,6 +606,11 @@ class JacobiSVD : public SVDBase<JacobiSVD<MatrixType_, Options_> > {
return compute_impl(matrix, m_computationOptions);
}
template <typename Derived>
JacobiSVD& compute(const TriangularBase<Derived>& matrix) {
return compute_impl(matrix, m_computationOptions);
}
/** \brief Method performing the decomposition of given matrix, as specified by
* the `computationOptions` parameter.
*
@@ -638,6 +648,8 @@ class JacobiSVD : public SVDBase<JacobiSVD<MatrixType_, Options_> > {
}
private:
template <typename Derived>
JacobiSVD& compute_impl(const TriangularBase<Derived>& matrix, unsigned int computationOptions);
template <typename Derived>
JacobiSVD& compute_impl(const MatrixBase<Derived>& matrix, unsigned int computationOptions);
@@ -676,6 +688,13 @@ class JacobiSVD : public SVDBase<JacobiSVD<MatrixType_, Options_> > {
WorkMatrixType m_workMatrix;
};
template <typename MatrixType, int Options>
template <typename Derived>
JacobiSVD<MatrixType, Options>& JacobiSVD<MatrixType, Options>::compute_impl(const TriangularBase<Derived>& matrix,
unsigned int computationOptions) {
return compute_impl(matrix.toDenseMatrix(), computationOptions);
}
template <typename MatrixType, int Options>
template <typename Derived>
JacobiSVD<MatrixType, Options>& JacobiSVD<MatrixType, Options>::compute_impl(const MatrixBase<Derived>& matrix,

View File

@@ -416,7 +416,8 @@ class SimplicialLLT : public SimplicialCholeskyBase<SimplicialLLT<MatrixType_, U
/** Performs a numeric decomposition of \a matrix
*
* The given matrix must has the same sparsity than the matrix on which the symbolic decomposition has been performed.
* The given matrix must have the same sparsity than the matrix on which the symbolic decomposition has been
* performed.
*
* \sa analyzePattern()
*/
@@ -504,7 +505,8 @@ class SimplicialLDLT : public SimplicialCholeskyBase<SimplicialLDLT<MatrixType_,
/** Performs a numeric decomposition of \a matrix
*
* The given matrix must has the same sparsity than the matrix on which the symbolic decomposition has been performed.
* The given matrix must have the same sparsity than the matrix on which the symbolic decomposition has been
* performed.
*
* \sa analyzePattern()
*/
@@ -585,7 +587,8 @@ class SimplicialNonHermitianLLT
/** Performs a numeric decomposition of \a matrix
*
* The given matrix must has the same sparsity than the matrix on which the symbolic decomposition has been performed.
* The given matrix must have the same sparsity than the matrix on which the symbolic decomposition has been
* performed.
*
* \sa analyzePattern()
*/
@@ -674,7 +677,8 @@ class SimplicialNonHermitianLDLT
/** Performs a numeric decomposition of \a matrix
*
* The given matrix must has the same sparsity than the matrix on which the symbolic decomposition has been performed.
* The given matrix must have the same sparsity than the matrix on which the symbolic decomposition has been
* performed.
*
* \sa analyzePattern()
*/
@@ -757,7 +761,8 @@ class SimplicialCholesky : public SimplicialCholeskyBase<SimplicialCholesky<Matr
/** Performs a numeric decomposition of \a matrix
*
* The given matrix must has the same sparsity than the matrix on which the symbolic decomposition has been performed.
* The given matrix must have the same sparsity than the matrix on which the symbolic decomposition has been
* performed.
*
* \sa analyzePattern()
*/

View File

@@ -480,6 +480,7 @@ class CompressedStorageIterator {
return *this;
}
inline reference operator*() const { return reference(m_data.keyPtr() + m_index, m_data.valuePtr() + m_index); }
inline reference operator[](int index) { return *(*this + index); }
#define MAKE_COMP(OP) \
inline bool operator OP(const CompressedStorageIterator& other) const { return m_index OP other.m_index; }

View File

@@ -140,7 +140,7 @@ class SparseVector : public SparseCompressedBase<SparseVector<Scalar_, Options_,
return insertBack(inner);
}
inline Scalar& insertBack(Index i) {
m_data.append(0, i);
m_data.append(Scalar(0), i);
return m_data.value(m_data.size() - 1);
}
@@ -150,7 +150,7 @@ class SparseVector : public SparseCompressedBase<SparseVector<Scalar_, Options_,
return insertBackUnordered(inner);
}
inline Scalar& insertBackUnordered(Index i) {
m_data.append(0, i);
m_data.append(Scalar(0), i);
return m_data.value(m_data.size() - 1);
}
@@ -177,7 +177,7 @@ class SparseVector : public SparseCompressedBase<SparseVector<Scalar_, Options_,
--p;
}
m_data.index(p + 1) = convert_index(i);
m_data.value(p + 1) = 0;
m_data.value(p + 1) = Scalar(0);
return m_data.value(p + 1);
}
@@ -367,7 +367,7 @@ class SparseVector : public SparseCompressedBase<SparseVector<Scalar_, Options_,
/** \internal \deprecated use insertBack(Index) */
EIGEN_DEPRECATED_WITH_REASON("Use .insertBack() instead.") Scalar& fill(Index i) {
m_data.append(0, i);
m_data.append(Scalar(0), i);
return m_data.value(m_data.size() - 1);
}