mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-15 21:26:00 +08:00
merge
This commit is contained in:
commit
c1e0b6dde3
@ -52,8 +52,8 @@ struct fixed_size_tensor_index_linearization_helper
|
||||
static inline Index run(array<Index, NumIndices> const& indices,
|
||||
const Dimensions& dimensions)
|
||||
{
|
||||
return array_get<RowMajor ? n : (NumIndices - n - 1)>(indices) +
|
||||
dget<RowMajor ? n : (NumIndices - n - 1), Dimensions>::value *
|
||||
return array_get<RowMajor ? n - 1 : (NumIndices - n)>(indices) +
|
||||
dget<RowMajor ? n - 1 : (NumIndices - n), Dimensions>::value *
|
||||
fixed_size_tensor_index_linearization_helper<Index, NumIndices, n - 1, RowMajor>::run(indices, dimensions);
|
||||
}
|
||||
};
|
||||
@ -62,10 +62,9 @@ template<typename Index, std::size_t NumIndices, bool RowMajor>
|
||||
struct fixed_size_tensor_index_linearization_helper<Index, NumIndices, 0, RowMajor>
|
||||
{
|
||||
template <typename Dimensions> EIGEN_DEVICE_FUNC
|
||||
static inline Index run(array<Index, NumIndices> const& indices,
|
||||
const Dimensions&)
|
||||
static inline Index run(array<Index, NumIndices> const&, const Dimensions&)
|
||||
{
|
||||
return array_get<RowMajor ? 0 : NumIndices - 1>(indices);
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
@ -135,11 +134,11 @@ struct Sizes : internal::numeric_list<std::ptrdiff_t, Indices...> {
|
||||
|
||||
template <typename DenseIndex> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
size_t IndexOfColMajor(const array<DenseIndex, Base::count>& indices) const {
|
||||
return internal::fixed_size_tensor_index_linearization_helper<DenseIndex, Base::count, Base::count - 1, false>::run(indices, *static_cast<const Base*>(this));
|
||||
return internal::fixed_size_tensor_index_linearization_helper<DenseIndex, Base::count, Base::count, false>::run(indices, *static_cast<const Base*>(this));
|
||||
}
|
||||
template <typename DenseIndex> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
size_t IndexOfRowMajor(const array<DenseIndex, Base::count>& indices) const {
|
||||
return internal::fixed_size_tensor_index_linearization_helper<DenseIndex, Base::count, Base::count - 1, true>::run(indices, *static_cast<const Base*>(this));
|
||||
return internal::fixed_size_tensor_index_linearization_helper<DenseIndex, Base::count, Base::count, true>::run(indices, *static_cast<const Base*>(this));
|
||||
}
|
||||
};
|
||||
|
||||
@ -222,11 +221,11 @@ template <std::size_t V1=0, std::size_t V2=0, std::size_t V3=0, std::size_t V4=0
|
||||
|
||||
template <typename DenseIndex> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
size_t IndexOfColMajor(const array<DenseIndex, Base::count>& indices) const {
|
||||
return internal::fixed_size_tensor_index_linearization_helper<DenseIndex, Base::count, Base::count - 1, false>::run(indices, *reinterpret_cast<const Base*>(this));
|
||||
return internal::fixed_size_tensor_index_linearization_helper<DenseIndex, Base::count, Base::count, false>::run(indices, *reinterpret_cast<const Base*>(this));
|
||||
}
|
||||
template <typename DenseIndex> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
size_t IndexOfRowMajor(const array<DenseIndex, Base::count>& indices) const {
|
||||
return internal::fixed_size_tensor_index_linearization_helper<DenseIndex, Base::count, Base::count - 1, true>::run(indices, *reinterpret_cast<const Base*>(this));
|
||||
return internal::fixed_size_tensor_index_linearization_helper<DenseIndex, Base::count, Base::count, true>::run(indices, *reinterpret_cast<const Base*>(this));
|
||||
}
|
||||
};
|
||||
|
||||
@ -402,22 +401,22 @@ template <std::size_t n, std::size_t V1, std::size_t V2, std::size_t V3, std::si
|
||||
|
||||
|
||||
template <typename Dims1, typename Dims2, size_t n, size_t m>
|
||||
struct sizes_match_up_to_dim {
|
||||
static inline bool run(Dims1&, Dims2&) {
|
||||
struct sizes_match_below_dim {
|
||||
static inline bool run(Dims1& dims1, Dims2& dims2) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
template <typename Dims1, typename Dims2, size_t n>
|
||||
struct sizes_match_up_to_dim<Dims1, Dims2, n, n> {
|
||||
struct sizes_match_below_dim<Dims1, Dims2, n, n> {
|
||||
static inline bool run(Dims1& dims1, Dims2& dims2) {
|
||||
return (array_get<n>(dims1) == array_get<n>(dims2)) &
|
||||
sizes_match_up_to_dim<Dims1, Dims2, n-1, n-1>::run(dims1, dims2);
|
||||
return (array_get<n-1>(dims1) == array_get<n-1>(dims2)) &
|
||||
sizes_match_below_dim<Dims1, Dims2, n-1, n-1>::run(dims1, dims2);
|
||||
}
|
||||
};
|
||||
template <typename Dims1, typename Dims2>
|
||||
struct sizes_match_up_to_dim<Dims1, Dims2, 0, 0> {
|
||||
static inline bool run(Dims1& dims1, Dims2& dims2) {
|
||||
return (array_get<0>(dims1) == array_get<0>(dims2));
|
||||
struct sizes_match_below_dim<Dims1, Dims2, 0, 0> {
|
||||
static inline bool run(Dims1&, Dims2&) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@ -426,7 +425,7 @@ struct sizes_match_up_to_dim<Dims1, Dims2, 0, 0> {
|
||||
|
||||
template <typename Dims1, typename Dims2>
|
||||
bool dimensions_match(Dims1& dims1, Dims2& dims2) {
|
||||
return internal::sizes_match_up_to_dim<Dims1, Dims2, internal::array_size<Dims1>::value-1, internal::array_size<Dims2>::value-1>::run(dims1, dims2);
|
||||
return internal::sizes_match_below_dim<Dims1, Dims2, internal::array_size<Dims1>::value, internal::array_size<Dims2>::value>::run(dims1, dims2);
|
||||
}
|
||||
|
||||
} // end namespace Eigen
|
||||
|
@ -204,7 +204,7 @@ struct TensorEvaluator<const TensorFFTOp<FFT, ArgType, FFTResultType, FFTDir>, D
|
||||
buf[i] = MakeComplex<internal::is_same<InputScalar, RealScalar>::value>()(m_impl.coeff(i));
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_fft.size(); ++i) {
|
||||
for (size_t i = 0; i < m_fft.size(); ++i) {
|
||||
int dim = m_fft[i];
|
||||
eigen_assert(dim >= 0 && dim < NumDims);
|
||||
Index line_len = m_dimensions[dim];
|
||||
|
@ -67,14 +67,14 @@ static void test_fft_complex_input_golden() {
|
||||
array<int, 1> fft;
|
||||
fft[0] = 0;
|
||||
|
||||
Tensor<std::complex<float>, 1, ColMajor, long> forward_output_both_parts = input.template fft<BothParts, FFT_FORWARD>(fft);
|
||||
Tensor<std::complex<float>, 1, ColMajor, long> reverse_output_both_parts = input.template fft<BothParts, FFT_REVERSE>(fft);
|
||||
Tensor<std::complex<float>, 1, ColMajor, long> forward_output_both_parts = input.fft<BothParts, FFT_FORWARD>(fft);
|
||||
Tensor<std::complex<float>, 1, ColMajor, long> reverse_output_both_parts = input.fft<BothParts, FFT_REVERSE>(fft);
|
||||
|
||||
Tensor<float, 1, ColMajor, long> forward_output_real_part = input.template fft<RealPart, FFT_FORWARD>(fft);
|
||||
Tensor<float, 1, ColMajor, long> reverse_output_real_part = input.template fft<RealPart, FFT_REVERSE>(fft);
|
||||
Tensor<float, 1, ColMajor, long> forward_output_real_part = input.fft<RealPart, FFT_FORWARD>(fft);
|
||||
Tensor<float, 1, ColMajor, long> reverse_output_real_part = input.fft<RealPart, FFT_REVERSE>(fft);
|
||||
|
||||
Tensor<float, 1, ColMajor, long> forward_output_imag_part = input.template fft<ImagPart, FFT_FORWARD>(fft);
|
||||
Tensor<float, 1, ColMajor, long> reverse_output_imag_part = input.template fft<ImagPart, FFT_REVERSE>(fft);
|
||||
Tensor<float, 1, ColMajor, long> forward_output_imag_part = input.fft<ImagPart, FFT_FORWARD>(fft);
|
||||
Tensor<float, 1, ColMajor, long> reverse_output_imag_part = input.fft<ImagPart, FFT_REVERSE>(fft);
|
||||
|
||||
VERIFY_IS_EQUAL(forward_output_both_parts.dimension(0), input.dimension(0));
|
||||
VERIFY_IS_EQUAL(reverse_output_both_parts.dimension(0), input.dimension(0));
|
||||
@ -124,14 +124,14 @@ static void test_fft_real_input_golden() {
|
||||
array<int, 1> fft;
|
||||
fft[0] = 0;
|
||||
|
||||
Tensor<std::complex<float>, 1, ColMajor, long> forward_output_both_parts = input.template fft<BothParts, FFT_FORWARD>(fft);
|
||||
Tensor<std::complex<float>, 1, ColMajor, long> reverse_output_both_parts = input.template fft<BothParts, FFT_REVERSE>(fft);
|
||||
Tensor<std::complex<float>, 1, ColMajor, long> forward_output_both_parts = input.fft<BothParts, FFT_FORWARD>(fft);
|
||||
Tensor<std::complex<float>, 1, ColMajor, long> reverse_output_both_parts = input.fft<BothParts, FFT_REVERSE>(fft);
|
||||
|
||||
Tensor<float, 1, ColMajor, long> forward_output_real_part = input.template fft<RealPart, FFT_FORWARD>(fft);
|
||||
Tensor<float, 1, ColMajor, long> reverse_output_real_part = input.template fft<RealPart, FFT_REVERSE>(fft);
|
||||
Tensor<float, 1, ColMajor, long> forward_output_real_part = input.fft<RealPart, FFT_FORWARD>(fft);
|
||||
Tensor<float, 1, ColMajor, long> reverse_output_real_part = input.fft<RealPart, FFT_REVERSE>(fft);
|
||||
|
||||
Tensor<float, 1, ColMajor, long> forward_output_imag_part = input.template fft<ImagPart, FFT_FORWARD>(fft);
|
||||
Tensor<float, 1, ColMajor, long> reverse_output_imag_part = input.template fft<ImagPart, FFT_REVERSE>(fft);
|
||||
Tensor<float, 1, ColMajor, long> forward_output_imag_part = input.fft<ImagPart, FFT_FORWARD>(fft);
|
||||
Tensor<float, 1, ColMajor, long> reverse_output_imag_part = input.fft<ImagPart, FFT_REVERSE>(fft);
|
||||
|
||||
VERIFY_IS_EQUAL(forward_output_both_parts.dimension(0), input.dimension(0));
|
||||
VERIFY_IS_EQUAL(reverse_output_both_parts.dimension(0), input.dimension(0));
|
||||
|
Loading…
x
Reference in New Issue
Block a user