mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-12 17:33:15 +08:00
s/id/p to avoid name clash
This commit is contained in:
parent
156a31b0e9
commit
d8b26cfeec
@ -297,11 +297,11 @@ class SparseInnerVectorSet<SparseMatrix<_Scalar, _Options, _Index>, Size>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update outer index pointers
|
// update outer index pointers
|
||||||
Index id = nnz_head;
|
Index p = nnz_head;
|
||||||
for(Index k=1; k<m_outerSize.value(); ++k)
|
for(Index k=1; k<m_outerSize.value(); ++k)
|
||||||
{
|
{
|
||||||
matrix._outerIndexPtr()[m_outerStart+k] = id;
|
matrix._outerIndexPtr()[m_outerStart+k] = p;
|
||||||
id += tmp.innerVector(k).nonZeros();
|
p += tmp.innerVector(k).nonZeros();
|
||||||
}
|
}
|
||||||
std::ptrdiff_t offset = nnz - nnz_previous;
|
std::ptrdiff_t offset = nnz - nnz_previous;
|
||||||
for(Index k = m_outerStart + m_outerSize.value(); k<=matrix.outerSize(); ++k)
|
for(Index k = m_outerStart + m_outerSize.value(); k<=matrix.outerSize(); ++k)
|
||||||
|
@ -129,9 +129,9 @@ class SparseMatrix
|
|||||||
Index end = m_outerIndex[outer+1];
|
Index end = m_outerIndex[outer+1];
|
||||||
eigen_assert(end>=start && "you probably called coeffRef on a non finalized matrix");
|
eigen_assert(end>=start && "you probably called coeffRef on a non finalized matrix");
|
||||||
eigen_assert(end>start && "coeffRef cannot be called on a zero coefficient");
|
eigen_assert(end>start && "coeffRef cannot be called on a zero coefficient");
|
||||||
const Index id = m_data.searchLowerIndex(start,end-1,inner);
|
const Index p = m_data.searchLowerIndex(start,end-1,inner);
|
||||||
eigen_assert((id<end) && (m_data.index(id)==inner) && "coeffRef cannot be called on a zero coefficient");
|
eigen_assert((p<end) && (m_data.index(p)==inner) && "coeffRef cannot be called on a zero coefficient");
|
||||||
return m_data.value(id);
|
return m_data.value(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -175,19 +175,19 @@ class SparseMatrix
|
|||||||
{
|
{
|
||||||
eigen_assert(size_t(m_outerIndex[outer+1]) == m_data.size() && "Invalid ordered insertion (invalid outer index)");
|
eigen_assert(size_t(m_outerIndex[outer+1]) == m_data.size() && "Invalid ordered insertion (invalid outer index)");
|
||||||
eigen_assert( (m_outerIndex[outer+1]-m_outerIndex[outer]==0 || m_data.index(m_data.size()-1)<inner) && "Invalid ordered insertion (invalid inner index)");
|
eigen_assert( (m_outerIndex[outer+1]-m_outerIndex[outer]==0 || m_data.index(m_data.size()-1)<inner) && "Invalid ordered insertion (invalid inner index)");
|
||||||
Index id = m_outerIndex[outer+1];
|
Index p = m_outerIndex[outer+1];
|
||||||
++m_outerIndex[outer+1];
|
++m_outerIndex[outer+1];
|
||||||
m_data.append(0, inner);
|
m_data.append(0, inner);
|
||||||
return m_data.value(id);
|
return m_data.value(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \warning use it only if you know what you are doing */
|
/** \warning use it only if you know what you are doing */
|
||||||
inline Scalar& insertBackByOuterInnerUnordered(Index outer, Index inner)
|
inline Scalar& insertBackByOuterInnerUnordered(Index outer, Index inner)
|
||||||
{
|
{
|
||||||
Index id = m_outerIndex[outer+1];
|
Index p = m_outerIndex[outer+1];
|
||||||
++m_outerIndex[outer+1];
|
++m_outerIndex[outer+1];
|
||||||
m_data.append(0, inner);
|
m_data.append(0, inner);
|
||||||
return m_data.value(id);
|
return m_data.value(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \sa insertBack, insertBackByOuterInner */
|
/** \sa insertBack, insertBackByOuterInner */
|
||||||
@ -233,7 +233,7 @@ class SparseMatrix
|
|||||||
|
|
||||||
size_t startId = m_outerIndex[outer];
|
size_t startId = m_outerIndex[outer];
|
||||||
// FIXME let's make sure sizeof(long int) == sizeof(size_t)
|
// FIXME let's make sure sizeof(long int) == sizeof(size_t)
|
||||||
size_t id = m_outerIndex[outer+1];
|
size_t p = m_outerIndex[outer+1];
|
||||||
++m_outerIndex[outer+1];
|
++m_outerIndex[outer+1];
|
||||||
|
|
||||||
float reallocRatio = 1;
|
float reallocRatio = 1;
|
||||||
@ -272,7 +272,7 @@ class SparseMatrix
|
|||||||
m_outerIndex[k++] = 1;
|
m_outerIndex[k++] = 1;
|
||||||
while (k<=m_outerSize && m_outerIndex[k]!=0)
|
while (k<=m_outerSize && m_outerIndex[k]!=0)
|
||||||
m_outerIndex[k++]++;
|
m_outerIndex[k++]++;
|
||||||
id = 0;
|
p = 0;
|
||||||
--k;
|
--k;
|
||||||
k = m_outerIndex[k]-1;
|
k = m_outerIndex[k]-1;
|
||||||
while (k>0)
|
while (k>0)
|
||||||
@ -292,7 +292,7 @@ class SparseMatrix
|
|||||||
--j;
|
--j;
|
||||||
// shift data of last vecs:
|
// shift data of last vecs:
|
||||||
Index k = m_outerIndex[j]-1;
|
Index k = m_outerIndex[j]-1;
|
||||||
while (k>=Index(id))
|
while (k>=Index(p))
|
||||||
{
|
{
|
||||||
m_data.index(k) = m_data.index(k-1);
|
m_data.index(k) = m_data.index(k-1);
|
||||||
m_data.value(k) = m_data.value(k-1);
|
m_data.value(k) = m_data.value(k-1);
|
||||||
@ -301,15 +301,15 @@ class SparseMatrix
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while ( (id > startId) && (m_data.index(id-1) > inner) )
|
while ( (p > startId) && (m_data.index(p-1) > inner) )
|
||||||
{
|
{
|
||||||
m_data.index(id) = m_data.index(id-1);
|
m_data.index(p) = m_data.index(p-1);
|
||||||
m_data.value(id) = m_data.value(id-1);
|
m_data.value(p) = m_data.value(p-1);
|
||||||
--id;
|
--p;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_data.index(id) = inner;
|
m_data.index(p) = inner;
|
||||||
return (m_data.value(id) = 0);
|
return (m_data.value(p) = 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -591,11 +591,11 @@ class SparseMatrix
|
|||||||
}
|
}
|
||||||
// std::cerr << size_t(m_outerIndex[outer+1]) << " == " << m_data.size() << "\n";
|
// std::cerr << size_t(m_outerIndex[outer+1]) << " == " << m_data.size() << "\n";
|
||||||
assert(size_t(m_outerIndex[outer+1]) == m_data.size());
|
assert(size_t(m_outerIndex[outer+1]) == m_data.size());
|
||||||
Index id = m_outerIndex[outer+1];
|
Index p = m_outerIndex[outer+1];
|
||||||
++m_outerIndex[outer+1];
|
++m_outerIndex[outer+1];
|
||||||
|
|
||||||
m_data.append(0, inner);
|
m_data.append(0, inner);
|
||||||
return m_data.value(id);
|
return m_data.value(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \deprecated use finalize */
|
/** \deprecated use finalize */
|
||||||
|
@ -156,19 +156,19 @@ class SparseVector
|
|||||||
Scalar& insert(Index i)
|
Scalar& insert(Index i)
|
||||||
{
|
{
|
||||||
Index startId = 0;
|
Index startId = 0;
|
||||||
Index id = m_data.size() - 1;
|
Index p = m_data.size() - 1;
|
||||||
// TODO smart realloc
|
// TODO smart realloc
|
||||||
m_data.resize(id+2,1);
|
m_data.resize(p+2,1);
|
||||||
|
|
||||||
while ( (id >= startId) && (m_data.index(id) > i) )
|
while ( (p >= startId) && (m_data.index(p) > i) )
|
||||||
{
|
{
|
||||||
m_data.index(id+1) = m_data.index(id);
|
m_data.index(p+1) = m_data.index(p);
|
||||||
m_data.value(id+1) = m_data.value(id);
|
m_data.value(p+1) = m_data.value(p);
|
||||||
--id;
|
--p;
|
||||||
}
|
}
|
||||||
m_data.index(id+1) = i;
|
m_data.index(p+1) = i;
|
||||||
m_data.value(id+1) = 0;
|
m_data.value(p+1) = 0;
|
||||||
return m_data.value(id+1);
|
return m_data.value(p+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user