mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-02-23 18:20:47 +08:00
Fix compiler warnings.
This commit is contained in:
parent
0ecae61568
commit
77b48c440e
@ -538,7 +538,9 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
|
||||
if (ColsAtCompileTime == 1 && list.size() == 1) {
|
||||
eigen_assert(list_size == static_cast<size_t>(RowsAtCompileTime) || RowsAtCompileTime == Dynamic);
|
||||
resize(list_size, ColsAtCompileTime);
|
||||
if (list.begin()->begin() != nullptr) {
|
||||
std::copy(list.begin()->begin(), list.begin()->end(), m_storage.data());
|
||||
}
|
||||
} else {
|
||||
eigen_assert(list.size() == static_cast<size_t>(RowsAtCompileTime) || RowsAtCompileTime == Dynamic);
|
||||
eigen_assert(list_size == static_cast<size_t>(ColsAtCompileTime) || ColsAtCompileTime == Dynamic);
|
||||
|
@ -534,7 +534,7 @@ template<typename LhsScalar,typename RhsScalar>
|
||||
using Scalar = LhsScalar;
|
||||
enum {
|
||||
PacketAccess = is_same<LhsScalar,RhsScalar>::value && packet_traits<Scalar>::HasATan && packet_traits<Scalar>::HasDiv && !NumTraits<Scalar>::IsInteger && !NumTraits<Scalar>::IsComplex,
|
||||
Cost = scalar_div_cost<Scalar, PacketAccess>::value + functor_traits<scalar_atan_op<Scalar>>::Cost
|
||||
Cost = int(scalar_div_cost<Scalar, PacketAccess>::value) + int(functor_traits<scalar_atan_op<Scalar>>::Cost)
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -23,13 +23,12 @@ template<typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename Rh
|
||||
struct triangular_matrix_vector_product<Index,Mode,LhsScalar,ConjLhs,RhsScalar,ConjRhs,ColMajor,Version>
|
||||
{
|
||||
typedef typename ScalarBinaryOpTraits<LhsScalar, RhsScalar>::ReturnType ResScalar;
|
||||
enum {
|
||||
IsLower = ((Mode&Lower)==Lower),
|
||||
HasUnitDiag = (Mode & UnitDiag)==UnitDiag,
|
||||
HasZeroDiag = (Mode & ZeroDiag)==ZeroDiag
|
||||
};
|
||||
static constexpr bool IsLower = ((Mode & Lower) == Lower);
|
||||
static constexpr bool HasUnitDiag = (Mode & UnitDiag) == UnitDiag;
|
||||
static constexpr bool HasZeroDiag = (Mode & ZeroDiag) == ZeroDiag;
|
||||
static EIGEN_DONT_INLINE void run(Index _rows, Index _cols, const LhsScalar* _lhs, Index lhsStride,
|
||||
const RhsScalar* _rhs, Index rhsIncr, ResScalar* _res, Index resIncr, const RhsScalar& alpha);
|
||||
const RhsScalar* _rhs, Index rhsIncr, ResScalar* _res, Index resIncr,
|
||||
const RhsScalar& alpha);
|
||||
};
|
||||
|
||||
template<typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar, bool ConjRhs, int Version>
|
||||
@ -94,13 +93,12 @@ template<typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename Rh
|
||||
struct triangular_matrix_vector_product<Index,Mode,LhsScalar,ConjLhs,RhsScalar,ConjRhs,RowMajor,Version>
|
||||
{
|
||||
typedef typename ScalarBinaryOpTraits<LhsScalar, RhsScalar>::ReturnType ResScalar;
|
||||
enum {
|
||||
IsLower = ((Mode&Lower)==Lower),
|
||||
HasUnitDiag = (Mode & UnitDiag)==UnitDiag,
|
||||
HasZeroDiag = (Mode & ZeroDiag)==ZeroDiag
|
||||
};
|
||||
static constexpr bool IsLower = ((Mode & Lower) == Lower);
|
||||
static constexpr bool HasUnitDiag = (Mode & UnitDiag) == UnitDiag;
|
||||
static constexpr bool HasZeroDiag = (Mode & ZeroDiag) == ZeroDiag;
|
||||
static EIGEN_DONT_INLINE void run(Index _rows, Index _cols, const LhsScalar* _lhs, Index lhsStride,
|
||||
const RhsScalar* _rhs, Index rhsIncr, ResScalar* _res, Index resIncr, const ResScalar& alpha);
|
||||
const RhsScalar* _rhs, Index rhsIncr, ResScalar* _res, Index resIncr,
|
||||
const ResScalar& alpha);
|
||||
};
|
||||
|
||||
template<typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar, bool ConjRhs,int Version>
|
||||
@ -216,8 +214,9 @@ template<int Mode> struct trmv_selector<Mode,ColMajor>
|
||||
typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhsType;
|
||||
typedef internal::blas_traits<Rhs> RhsBlasTraits;
|
||||
typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType;
|
||||
constexpr int Alignment = (std::min)(int(AlignedMax), int(internal::packet_traits<ResScalar>::size));
|
||||
|
||||
typedef Map<Matrix<ResScalar,Dynamic,1>, plain_enum_min(AlignedMax,internal::packet_traits<ResScalar>::size)> MappedDest;
|
||||
typedef Map<Matrix<ResScalar,Dynamic,1>, Alignment> MappedDest;
|
||||
|
||||
add_const_on_value_type_t<ActualLhsType> actualLhs = LhsBlasTraits::extract(lhs);
|
||||
add_const_on_value_type_t<ActualRhsType> actualRhs = RhsBlasTraits::extract(rhs);
|
||||
@ -226,13 +225,11 @@ template<int Mode> struct trmv_selector<Mode,ColMajor>
|
||||
RhsScalar rhs_alpha = RhsBlasTraits::extractScalarFactor(rhs);
|
||||
ResScalar actualAlpha = alpha * lhs_alpha * rhs_alpha;
|
||||
|
||||
enum {
|
||||
// FIXME find a way to allow an inner stride on the result if packet_traits<Scalar>::size==1
|
||||
// on, the other hand it is good for the cache to pack the vector anyways...
|
||||
EvalToDestAtCompileTime = Dest::InnerStrideAtCompileTime==1,
|
||||
ComplexByReal = (NumTraits<LhsScalar>::IsComplex) && (!NumTraits<RhsScalar>::IsComplex),
|
||||
MightCannotUseDest = (Dest::InnerStrideAtCompileTime!=1) || ComplexByReal
|
||||
};
|
||||
constexpr bool EvalToDestAtCompileTime = Dest::InnerStrideAtCompileTime==1;
|
||||
constexpr bool ComplexByReal = (NumTraits<LhsScalar>::IsComplex) && (!NumTraits<RhsScalar>::IsComplex);
|
||||
constexpr bool MightCannotUseDest = (Dest::InnerStrideAtCompileTime!=1) || ComplexByReal;
|
||||
|
||||
gemv_static_vector_if<ResScalar,Dest::SizeAtCompileTime,Dest::MaxSizeAtCompileTime,MightCannotUseDest> static_dest;
|
||||
|
||||
@ -307,9 +304,7 @@ template<int Mode> struct trmv_selector<Mode,RowMajor>
|
||||
RhsScalar rhs_alpha = RhsBlasTraits::extractScalarFactor(rhs);
|
||||
ResScalar actualAlpha = alpha * lhs_alpha * rhs_alpha;
|
||||
|
||||
enum {
|
||||
DirectlyUseRhs = ActualRhsTypeCleaned::InnerStrideAtCompileTime==1
|
||||
};
|
||||
constexpr bool DirectlyUseRhs = ActualRhsTypeCleaned::InnerStrideAtCompileTime==1;
|
||||
|
||||
gemv_static_vector_if<RhsScalar,ActualRhsTypeCleaned::SizeAtCompileTime,ActualRhsTypeCleaned::MaxSizeAtCompileTime,!DirectlyUseRhs> static_rhs;
|
||||
|
||||
|
@ -347,18 +347,15 @@ struct apply_rotation_in_the_plane_selector<Scalar,OtherScalar,SizeAtCompileTime
|
||||
typedef typename packet_traits<Scalar>::type Packet;
|
||||
typedef typename packet_traits<OtherScalar>::type OtherPacket;
|
||||
|
||||
enum {
|
||||
RequiredAlignment = plain_enum_max(unpacket_traits<Packet>::alignment,
|
||||
unpacket_traits<OtherPacket>::alignment),
|
||||
PacketSize = packet_traits<Scalar>::size,
|
||||
OtherPacketSize = packet_traits<OtherScalar>::size
|
||||
};
|
||||
constexpr int RequiredAlignment =
|
||||
(std::max)(unpacket_traits<Packet>::alignment, unpacket_traits<OtherPacket>::alignment);
|
||||
constexpr Index PacketSize = packet_traits<Scalar>::size;
|
||||
|
||||
/*** dynamic-size vectorized paths ***/
|
||||
if(size >= 2 * PacketSize && SizeAtCompileTime == Dynamic && ((incrx == 1 && incry == 1) || PacketSize == 1))
|
||||
{
|
||||
// both vectors are sequentially stored in memory => vectorization
|
||||
enum { Peeling = 2 };
|
||||
constexpr Index Peeling = 2;
|
||||
|
||||
Index alignedStart = internal::first_default_aligned(y, size);
|
||||
Index alignedEnd = alignedStart + ((size-alignedStart)/PacketSize)*PacketSize;
|
||||
@ -474,11 +471,9 @@ void inline apply_rotation_in_the_plane(DenseBase<VectorX>& xpr_x, DenseBase<Vec
|
||||
if (numext::is_exactly_one(c) && numext::is_exactly_zero(s))
|
||||
return;
|
||||
|
||||
apply_rotation_in_the_plane_selector<
|
||||
Scalar,OtherScalar,
|
||||
VectorX::SizeAtCompileTime,
|
||||
plain_enum_min(evaluator<VectorX>::Alignment, evaluator<VectorY>::Alignment),
|
||||
Vectorizable>::run(x,incrx,y,incry,size,c,s);
|
||||
constexpr int Alignment = (std::min)(int(evaluator<VectorX>::Alignment), int(evaluator<VectorY>::Alignment));
|
||||
apply_rotation_in_the_plane_selector<Scalar, OtherScalar, VectorX::SizeAtCompileTime, Alignment, Vectorizable>::run(
|
||||
x, incrx, y, incry, size, c, s);
|
||||
}
|
||||
|
||||
} // end namespace internal
|
||||
|
@ -32,6 +32,7 @@ EIGEN_DECLARE_TEST(unalignedcount)
|
||||
{
|
||||
#if defined(EIGEN_VECTORIZE_AVX512)
|
||||
VectorXf a(48), b(48);
|
||||
a.fill(0); b.fill(1);
|
||||
VERIFY_ALIGNED_UNALIGNED_COUNT(a += b, 6, 0, 3, 0);
|
||||
VERIFY_ALIGNED_UNALIGNED_COUNT(a.segment(0,48) += b.segment(0,48), 3, 3, 3, 0);
|
||||
VERIFY_ALIGNED_UNALIGNED_COUNT(a.segment(0,48) -= b.segment(0,48), 3, 3, 3, 0);
|
||||
@ -39,6 +40,7 @@ EIGEN_DECLARE_TEST(unalignedcount)
|
||||
VERIFY_ALIGNED_UNALIGNED_COUNT(a.segment(0,48) /= 3.5, 3, 0, 3, 0);
|
||||
#elif defined(EIGEN_VECTORIZE_AVX)
|
||||
VectorXf a(40), b(40);
|
||||
a.fill(0); b.fill(1);
|
||||
VERIFY_ALIGNED_UNALIGNED_COUNT(a += b, 10, 0, 5, 0);
|
||||
VERIFY_ALIGNED_UNALIGNED_COUNT(a.segment(0,40) += b.segment(0,40), 5, 5, 5, 0);
|
||||
VERIFY_ALIGNED_UNALIGNED_COUNT(a.segment(0,40) -= b.segment(0,40), 5, 5, 5, 0);
|
||||
@ -46,6 +48,7 @@ EIGEN_DECLARE_TEST(unalignedcount)
|
||||
VERIFY_ALIGNED_UNALIGNED_COUNT(a.segment(0,40) /= 3.5, 5, 0, 5, 0);
|
||||
#elif defined(EIGEN_VECTORIZE_SSE)
|
||||
VectorXf a(40), b(40);
|
||||
a.fill(0); b.fill(1);
|
||||
VERIFY_ALIGNED_UNALIGNED_COUNT(a += b, 20, 0, 10, 0);
|
||||
VERIFY_ALIGNED_UNALIGNED_COUNT(a.segment(0,40) += b.segment(0,40), 10, 10, 10, 0);
|
||||
VERIFY_ALIGNED_UNALIGNED_COUNT(a.segment(0,40) -= b.segment(0,40), 10, 10, 10, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user