mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-01-24 14:45:14 +08:00
Fix shadowing
This commit is contained in:
parent
297ca62319
commit
0c56d22e2e
@ -945,7 +945,7 @@ void BDCSVD<MatrixType>::perturbCol0
|
||||
zhat.setZero();
|
||||
return;
|
||||
}
|
||||
Index last = perm(m-1);
|
||||
Index lastIdx = perm(m-1);
|
||||
// The offset permits to skip deflated entries while computing zhat
|
||||
for (Index k = 0; k < n; ++k)
|
||||
{
|
||||
@ -955,12 +955,12 @@ void BDCSVD<MatrixType>::perturbCol0
|
||||
{
|
||||
// see equation (3.6)
|
||||
RealScalar dk = diag(k);
|
||||
RealScalar prod = (singVals(last) + dk) * (mus(last) + (shifts(last) - dk));
|
||||
RealScalar prod = (singVals(lastIdx) + dk) * (mus(lastIdx) + (shifts(lastIdx) - dk));
|
||||
#ifdef EIGEN_BDCSVD_SANITY_CHECKS
|
||||
if(prod<0) {
|
||||
std::cout << "k = " << k << " ; z(k)=" << col0(k) << ", diag(k)=" << dk << "\n";
|
||||
std::cout << "prod = " << "(" << singVals(last) << " + " << dk << ") * (" << mus(last) << " + (" << shifts(last) << " - " << dk << "))" << "\n";
|
||||
std::cout << " = " << singVals(last) + dk << " * " << mus(last) + (shifts(last) - dk) << "\n";
|
||||
std::cout << "prod = " << "(" << singVals(lastIdx) << " + " << dk << ") * (" << mus(lastIdx) << " + (" << shifts(lastIdx) << " - " << dk << "))" << "\n";
|
||||
std::cout << " = " << singVals(lastIdx) + dk << " * " << mus(lastIdx) + (shifts(lastIdx) - dk) << "\n";
|
||||
}
|
||||
assert(prod>=0);
|
||||
#endif
|
||||
@ -1000,7 +1000,7 @@ void BDCSVD<MatrixType>::perturbCol0
|
||||
}
|
||||
}
|
||||
#ifdef EIGEN_BDCSVD_DEBUG_VERBOSE
|
||||
std::cout << "zhat(" << k << ") = sqrt( " << prod << ") ; " << (singVals(last) + dk) << " * " << mus(last) + shifts(last) << " - " << dk << "\n";
|
||||
std::cout << "zhat(" << k << ") = sqrt( " << prod << ") ; " << (singVals(lastIdx) + dk) << " * " << mus(lastIdx) + shifts(lastIdx) << " - " << dk << "\n";
|
||||
#endif
|
||||
RealScalar tmp = sqrt(prod);
|
||||
#ifdef EIGEN_BDCSVD_SANITY_CHECKS
|
||||
|
@ -604,9 +604,9 @@ class SparseMatrix
|
||||
m_outerIndex = newOuterIndex;
|
||||
if (outerChange > 0)
|
||||
{
|
||||
StorageIndex last = m_outerSize == 0 ? 0 : m_outerIndex[m_outerSize];
|
||||
StorageIndex lastIdx = m_outerSize == 0 ? 0 : m_outerIndex[m_outerSize];
|
||||
for(Index i=m_outerSize; i<m_outerSize+outerChange+1; i++)
|
||||
m_outerIndex[i] = last;
|
||||
m_outerIndex[i] = lastIdx;
|
||||
}
|
||||
m_outerSize += outerChange;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
// [function]
|
||||
template <class ArgType, class RowIndexType, class ColIndexType>
|
||||
CwiseNullaryOp<indexing_functor<ArgType,RowIndexType,ColIndexType>, typename indexing_functor<ArgType,RowIndexType,ColIndexType>::MatrixType>
|
||||
indexing(const Eigen::MatrixBase<ArgType>& arg, const RowIndexType& row_indices, const ColIndexType& col_indices)
|
||||
mat_indexing(const Eigen::MatrixBase<ArgType>& arg, const RowIndexType& row_indices, const ColIndexType& col_indices)
|
||||
{
|
||||
typedef indexing_functor<ArgType,RowIndexType,ColIndexType> Func;
|
||||
typedef typename Func::MatrixType MatrixType;
|
||||
@ -45,7 +45,7 @@ int main()
|
||||
Eigen::MatrixXi A = Eigen::MatrixXi::Random(4,4);
|
||||
Array3i ri(1,2,1);
|
||||
ArrayXi ci(6); ci << 3,2,1,0,0,2;
|
||||
Eigen::MatrixXi B = indexing(A, ri, ci);
|
||||
Eigen::MatrixXi B = mat_indexing(A, ri, ci);
|
||||
std::cout << "A =" << std::endl;
|
||||
std::cout << A << std::endl << std::endl;
|
||||
std::cout << "A([" << ri.transpose() << "], [" << ci.transpose() << "]) =" << std::endl;
|
||||
@ -53,11 +53,11 @@ int main()
|
||||
std::cout << "[main1]\n";
|
||||
|
||||
std::cout << "[main2]\n";
|
||||
B = indexing(A, ri+1, ci);
|
||||
B = mat_indexing(A, ri+1, ci);
|
||||
std::cout << "A(ri+1,ci) =" << std::endl;
|
||||
std::cout << B << std::endl << std::endl;
|
||||
#if __cplusplus >= 201103L
|
||||
B = indexing(A, ArrayXi::LinSpaced(13,0,12).unaryExpr([](int x){return x%4;}), ArrayXi::LinSpaced(4,0,3));
|
||||
B = mat_indexing(A, ArrayXi::LinSpaced(13,0,12).unaryExpr([](int x){return x%4;}), ArrayXi::LinSpaced(4,0,3));
|
||||
std::cout << "A(ArrayXi::LinSpaced(13,0,12).unaryExpr([](int x){return x%4;}), ArrayXi::LinSpaced(4,0,3)) =" << std::endl;
|
||||
std::cout << B << std::endl << std::endl;
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user