mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-31 17:22:07 +08:00
Fix shadow warnings triggered by clang
This commit is contained in:
parent
cd8b996f99
commit
9a2447b0c9
@ -434,26 +434,30 @@ struct palign_impl<Offset,Packet8f>
|
|||||||
if (Offset==1)
|
if (Offset==1)
|
||||||
{
|
{
|
||||||
first = _mm256_blend_ps(first, second, 1);
|
first = _mm256_blend_ps(first, second, 1);
|
||||||
Packet8f tmp = _mm256_permute_ps (first, _MM_SHUFFLE(0,3,2,1));
|
Packet8f tmp1 = _mm256_permute_ps (first, _MM_SHUFFLE(0,3,2,1));
|
||||||
first = _mm256_blend_ps(tmp, _mm256_permute2f128_ps (tmp, tmp, 1), 0x88);
|
Packet8f tmp2 = _mm256_permute2f128_ps (tmp1, tmp1, 1);
|
||||||
|
first = _mm256_blend_ps(tmp1, tmp2, 0x88);
|
||||||
}
|
}
|
||||||
else if (Offset==2)
|
else if (Offset==2)
|
||||||
{
|
{
|
||||||
first = _mm256_blend_ps(first, second, 3);
|
first = _mm256_blend_ps(first, second, 3);
|
||||||
Packet8f tmp = _mm256_permute_ps (first, _MM_SHUFFLE(1,0,3,2));
|
Packet8f tmp1 = _mm256_permute_ps (first, _MM_SHUFFLE(1,0,3,2));
|
||||||
first = _mm256_blend_ps(tmp, _mm256_permute2f128_ps (tmp, tmp, 1), 0xcc);
|
Packet8f tmp2 = _mm256_permute2f128_ps (tmp1, tmp1, 1);
|
||||||
|
first = _mm256_blend_ps(tmp1, tmp2, 0xcc);
|
||||||
}
|
}
|
||||||
else if (Offset==3)
|
else if (Offset==3)
|
||||||
{
|
{
|
||||||
first = _mm256_blend_ps(first, second, 7);
|
first = _mm256_blend_ps(first, second, 7);
|
||||||
Packet8f tmp = _mm256_permute_ps (first, _MM_SHUFFLE(2,1,0,3));
|
Packet8f tmp1 = _mm256_permute_ps (first, _MM_SHUFFLE(2,1,0,3));
|
||||||
first = _mm256_blend_ps(tmp, _mm256_permute2f128_ps (tmp, tmp, 1), 0xee);
|
Packet8f tmp2 = _mm256_permute2f128_ps (tmp1, tmp1, 1);
|
||||||
|
first = _mm256_blend_ps(tmp1, tmp2, 0xee);
|
||||||
}
|
}
|
||||||
else if (Offset==4)
|
else if (Offset==4)
|
||||||
{
|
{
|
||||||
first = _mm256_blend_ps(first, second, 15);
|
first = _mm256_blend_ps(first, second, 15);
|
||||||
Packet8f tmp = _mm256_permute_ps (first, _MM_SHUFFLE(3,2,1,0));
|
Packet8f tmp1 = _mm256_permute_ps (first, _MM_SHUFFLE(3,2,1,0));
|
||||||
first = _mm256_permute_ps(_mm256_permute2f128_ps (tmp, tmp, 1), _MM_SHUFFLE(3,2,1,0));
|
Packet8f tmp2 = _mm256_permute2f128_ps (tmp1, tmp1, 1);
|
||||||
|
first = _mm256_permute_ps(tmp2, _MM_SHUFFLE(3,2,1,0));
|
||||||
}
|
}
|
||||||
else if (Offset==5)
|
else if (Offset==5)
|
||||||
{
|
{
|
||||||
|
@ -117,8 +117,9 @@ EIGEN_DONT_INLINE void triangular_solve_matrix<Scalar,Index,OnTheLeft,Mode,Conju
|
|||||||
{
|
{
|
||||||
// TODO write a small kernel handling this (can be shared with trsv)
|
// TODO write a small kernel handling this (can be shared with trsv)
|
||||||
Index i = IsLower ? k2+k1+k : k2-k1-k-1;
|
Index i = IsLower ? k2+k1+k : k2-k1-k-1;
|
||||||
Index s = IsLower ? k2+k1 : i+1;
|
|
||||||
Index rs = actualPanelWidth - k - 1; // remaining size
|
Index rs = actualPanelWidth - k - 1; // remaining size
|
||||||
|
Index s = TriStorageOrder==RowMajor ? (IsLower ? k2+k1 : i+1)
|
||||||
|
: IsLower ? i+1 : i-rs;
|
||||||
|
|
||||||
Scalar a = (Mode & UnitDiag) ? Scalar(1) : Scalar(1)/conj(tri(i,i));
|
Scalar a = (Mode & UnitDiag) ? Scalar(1) : Scalar(1)/conj(tri(i,i));
|
||||||
for (Index j=j2; j<j2+actual_cols; ++j)
|
for (Index j=j2; j<j2+actual_cols; ++j)
|
||||||
@ -135,7 +136,6 @@ EIGEN_DONT_INLINE void triangular_solve_matrix<Scalar,Index,OnTheLeft,Mode,Conju
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Index s = IsLower ? i+1 : i-rs;
|
|
||||||
Scalar b = (other(i,j) *= a);
|
Scalar b = (other(i,j) *= a);
|
||||||
Scalar* r = &other(s,j);
|
Scalar* r = &other(s,j);
|
||||||
const Scalar* l = &tri(s,i);
|
const Scalar* l = &tri(s,i);
|
||||||
|
@ -315,8 +315,8 @@ namespace Eigen {
|
|||||||
const Index dim=m_S.cols();
|
const Index dim=m_S.cols();
|
||||||
if (abs(m_S.coeff(i+1,i))==Scalar(0))
|
if (abs(m_S.coeff(i+1,i))==Scalar(0))
|
||||||
return;
|
return;
|
||||||
Index z = findSmallDiagEntry(i,i+1);
|
Index j = findSmallDiagEntry(i,i+1);
|
||||||
if (z==i-1)
|
if (j==i-1)
|
||||||
{
|
{
|
||||||
// block of (S T^{-1})
|
// block of (S T^{-1})
|
||||||
Matrix2s STi = m_T.template block<2,2>(i,i).template triangularView<Upper>().
|
Matrix2s STi = m_T.template block<2,2>(i,i).template triangularView<Upper>().
|
||||||
@ -352,7 +352,7 @@ namespace Eigen {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pushDownZero(z,i,i+1);
|
pushDownZero(j,i,i+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -825,7 +825,7 @@ void BDCSVD<MatrixType>::computeSingVals(const ArrayRef& col0, const ArrayRef& d
|
|||||||
while (rightShifted - leftShifted > 2 * NumTraits<RealScalar>::epsilon() * numext::maxi<RealScalar>(abs(leftShifted), abs(rightShifted)))
|
while (rightShifted - leftShifted > 2 * NumTraits<RealScalar>::epsilon() * numext::maxi<RealScalar>(abs(leftShifted), abs(rightShifted)))
|
||||||
{
|
{
|
||||||
RealScalar midShifted = (leftShifted + rightShifted) / 2;
|
RealScalar midShifted = (leftShifted + rightShifted) / 2;
|
||||||
RealScalar fMid = secularEq(midShifted, col0, diag, perm, diagShifted, shift);
|
fMid = secularEq(midShifted, col0, diag, perm, diagShifted, shift);
|
||||||
if (fLeft * fMid < 0)
|
if (fLeft * fMid < 0)
|
||||||
{
|
{
|
||||||
rightShifted = midShifted;
|
rightShifted = midShifted;
|
||||||
|
@ -387,7 +387,7 @@ struct svd_precondition_2x2_block_to_be_real<MatrixType, QRPreconditioner, true>
|
|||||||
if(svd.computeU()) svd.m_matrixU.applyOnTheRight(p,q,rot.adjoint());
|
if(svd.computeU()) svd.m_matrixU.applyOnTheRight(p,q,rot.adjoint());
|
||||||
if(work_matrix.coeff(p,q) != Scalar(0))
|
if(work_matrix.coeff(p,q) != Scalar(0))
|
||||||
{
|
{
|
||||||
Scalar z = abs(work_matrix.coeff(p,q)) / work_matrix.coeff(p,q);
|
z = abs(work_matrix.coeff(p,q)) / work_matrix.coeff(p,q);
|
||||||
work_matrix.col(q) *= z;
|
work_matrix.col(q) *= z;
|
||||||
if(svd.computeV()) svd.m_matrixV.col(q) *= z;
|
if(svd.computeV()) svd.m_matrixV.col(q) *= z;
|
||||||
}
|
}
|
||||||
|
@ -1119,9 +1119,9 @@ typename SparseMatrix<_Scalar,_Options,_Index>::Scalar& SparseMatrix<_Scalar,_Op
|
|||||||
// so that the entire free-space is allocated to the current inner-vector.
|
// so that the entire free-space is allocated to the current inner-vector.
|
||||||
eigen_internal_assert(data_end < m_data.allocatedSize());
|
eigen_internal_assert(data_end < m_data.allocatedSize());
|
||||||
StorageIndex new_end = convert_index(m_data.allocatedSize());
|
StorageIndex new_end = convert_index(m_data.allocatedSize());
|
||||||
for(Index j=outer+1; j<=m_outerSize; ++j)
|
for(Index k=outer+1; k<=m_outerSize; ++k)
|
||||||
if(m_outerIndex[j]==data_end)
|
if(m_outerIndex[k]==data_end)
|
||||||
m_outerIndex[j] = new_end;
|
m_outerIndex[k] = new_end;
|
||||||
}
|
}
|
||||||
return m_data.value(p);
|
return m_data.value(p);
|
||||||
}
|
}
|
||||||
@ -1144,9 +1144,9 @@ typename SparseMatrix<_Scalar,_Options,_Index>::Scalar& SparseMatrix<_Scalar,_Op
|
|||||||
// so that the entire free-space is allocated to the current inner-vector.
|
// so that the entire free-space is allocated to the current inner-vector.
|
||||||
eigen_internal_assert(data_end < m_data.allocatedSize());
|
eigen_internal_assert(data_end < m_data.allocatedSize());
|
||||||
StorageIndex new_end = convert_index(m_data.allocatedSize());
|
StorageIndex new_end = convert_index(m_data.allocatedSize());
|
||||||
for(Index j=outer+1; j<=m_outerSize; ++j)
|
for(Index k=outer+1; k<=m_outerSize; ++k)
|
||||||
if(m_outerIndex[j]==data_end)
|
if(m_outerIndex[k]==data_end)
|
||||||
m_outerIndex[j] = new_end;
|
m_outerIndex[k] = new_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
// and insert it at the right position (sorted insertion)
|
// and insert it at the right position (sorted insertion)
|
||||||
|
@ -36,9 +36,9 @@ public:
|
|||||||
EIGEN_SPARSE_PUBLIC_INTERFACE(SparseView)
|
EIGEN_SPARSE_PUBLIC_INTERFACE(SparseView)
|
||||||
typedef typename internal::remove_all<MatrixType>::type NestedExpression;
|
typedef typename internal::remove_all<MatrixType>::type NestedExpression;
|
||||||
|
|
||||||
explicit SparseView(const MatrixType& mat, const Scalar& m_reference = Scalar(0),
|
explicit SparseView(const MatrixType& mat, const Scalar& reference = Scalar(0),
|
||||||
RealScalar m_epsilon = NumTraits<Scalar>::dummy_precision()) :
|
RealScalar epsilon = NumTraits<Scalar>::dummy_precision())
|
||||||
m_matrix(mat), m_reference(m_reference), m_epsilon(m_epsilon) {}
|
: m_matrix(mat), m_reference(reference), m_epsilon(epsilon) {}
|
||||||
|
|
||||||
inline Index rows() const { return m_matrix.rows(); }
|
inline Index rows() const { return m_matrix.rows(); }
|
||||||
inline Index cols() const { return m_matrix.cols(); }
|
inline Index cols() const { return m_matrix.cols(); }
|
||||||
|
@ -71,11 +71,11 @@ template<typename MatrixType> void inverse(const MatrixType& m)
|
|||||||
|
|
||||||
// check with submatrices
|
// check with submatrices
|
||||||
{
|
{
|
||||||
Matrix<Scalar, MatrixType::RowsAtCompileTime+1, MatrixType::RowsAtCompileTime+1, MatrixType::Options> m3;
|
Matrix<Scalar, MatrixType::RowsAtCompileTime+1, MatrixType::RowsAtCompileTime+1, MatrixType::Options> m5;
|
||||||
m3.setRandom();
|
m5.setRandom();
|
||||||
m3.topLeftCorner(rows,rows) = m1;
|
m5.topLeftCorner(rows,rows) = m1;
|
||||||
m2 = m3.template topLeftCorner<MatrixType::RowsAtCompileTime,MatrixType::ColsAtCompileTime>().inverse();
|
m2 = m5.template topLeftCorner<MatrixType::RowsAtCompileTime,MatrixType::ColsAtCompileTime>().inverse();
|
||||||
VERIFY_IS_APPROX( (m3.template topLeftCorner<MatrixType::RowsAtCompileTime,MatrixType::ColsAtCompileTime>()), m2.inverse() );
|
VERIFY_IS_APPROX( (m5.template topLeftCorner<MatrixType::RowsAtCompileTime,MatrixType::ColsAtCompileTime>()), m2.inverse() );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -267,7 +267,6 @@ template<typename Solver> void check_sparse_spd_solving(Solver& solver)
|
|||||||
{
|
{
|
||||||
if (it.sym() == SPD){
|
if (it.sym() == SPD){
|
||||||
A = it.matrix();
|
A = it.matrix();
|
||||||
Mat halfA;
|
|
||||||
DenseVector b = it.rhs();
|
DenseVector b = it.rhs();
|
||||||
DenseVector refX = it.refX();
|
DenseVector refX = it.refX();
|
||||||
PermutationMatrix<Dynamic, Dynamic, StorageIndex> pnull;
|
PermutationMatrix<Dynamic, Dynamic, StorageIndex> pnull;
|
||||||
|
@ -55,16 +55,16 @@ template<typename Scalar,typename Index> void sparse_vector(int rows, int cols)
|
|||||||
|
|
||||||
// test coeffRef with reallocation
|
// test coeffRef with reallocation
|
||||||
{
|
{
|
||||||
SparseVectorType v1(rows);
|
SparseVectorType v4(rows);
|
||||||
DenseVector v2 = DenseVector::Zero(rows);
|
DenseVector v5 = DenseVector::Zero(rows);
|
||||||
for(int k=0; k<rows; ++k)
|
for(int k=0; k<rows; ++k)
|
||||||
{
|
{
|
||||||
int i = internal::random<int>(0,rows-1);
|
int i = internal::random<int>(0,rows-1);
|
||||||
Scalar v = internal::random<Scalar>();
|
Scalar v = internal::random<Scalar>();
|
||||||
v1.coeffRef(i) += v;
|
v4.coeffRef(i) += v;
|
||||||
v2.coeffRef(i) += v;
|
v5.coeffRef(i) += v;
|
||||||
}
|
}
|
||||||
VERIFY_IS_APPROX(v1,v2);
|
VERIFY_IS_APPROX(v4,v5);
|
||||||
}
|
}
|
||||||
|
|
||||||
v1.coeffRef(nonzerocoords[0]) = Scalar(5);
|
v1.coeffRef(nonzerocoords[0]) = Scalar(5);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user