* replace postfix ++ by prefix ++ wherever that makes sense in Eigen/

* fix some "unused variable" warnings in the tests; there remains a libstdc++ "deprecated"
warning which I haven't looked much into
This commit is contained in:
Benoit Jacob
2008-12-17 14:30:01 +00:00
parent 2110cca431
commit 89f468671d
28 changed files with 164 additions and 162 deletions

View File

@@ -202,7 +202,7 @@ Scalar& AmbiVector<Scalar>::coeffRef(int i)
// this is the first element
m_llStart = 0;
m_llCurrent = 0;
m_llSize++;
++m_llSize;
llElements[0].value = Scalar(0);
llElements[0].index = i;
llElements[0].next = -1;
@@ -216,7 +216,7 @@ Scalar& AmbiVector<Scalar>::coeffRef(int i)
el.index = i;
el.next = m_llStart;
m_llStart = m_llSize;
m_llSize++;
++m_llSize;
m_llCurrent = m_llStart;
return el.value;
}
@@ -246,7 +246,7 @@ Scalar& AmbiVector<Scalar>::coeffRef(int i)
el.index = i;
el.next = llElements[m_llCurrent].next;
llElements[m_llCurrent].next = m_llSize;
m_llSize++;
++m_llSize;
return el.value;
}
}
@@ -332,7 +332,7 @@ class AmbiVector<_Scalar>::Iterator
if (m_isDense)
{
do {
m_cachedIndex++;
++m_cachedIndex;
} while (m_cachedIndex<m_vector.m_end && ei_abs(m_vector.m_buffer[m_cachedIndex])<m_epsilon);
if (m_cachedIndex<m_vector.m_end)
m_cachedValue = m_vector.m_buffer[m_cachedIndex];

View File

@@ -140,7 +140,7 @@ class RandomSetter
m_keyBitsOffset = 0;
while (aux)
{
m_keyBitsOffset++;
++m_keyBitsOffset;
aux = aux >> 1;
}
KeyType ik = (1<<(OuterPacketBits+m_keyBitsOffset));
@@ -183,7 +183,7 @@ class RandomSetter
for (typename HashMapType::iterator it = m_hashmaps[k].begin(); it!=end; ++it)
{
const int outer = it->first & keyBitsMask;
positions[outer]++;
++positions[outer];
}
}
// prefix sum

View File

@@ -203,10 +203,10 @@ void SparseLDLT<MatrixType,Backend>::_symbolic(const MatrixType& a)
if (P)
{
/* If P is present then compute Pinv, the inverse of P */
for (int k = 0; k < size; k++)
for (int k = 0; k < size; ++k)
Pinv[P[k]] = k;
}
for (int k = 0; k < size; k++)
for (int k = 0; k < size; ++k)
{
/* L(k,:) pattern: all nodes reachable in etree from nz in A(0:k-1,k) */
m_parent[k] = -1; /* parent of k is not yet known */
@@ -214,7 +214,7 @@ void SparseLDLT<MatrixType,Backend>::_symbolic(const MatrixType& a)
m_nonZerosPerCol[k] = 0; /* count of nonzeros in column k of L */
int kk = P ? P[k] : k; /* kth original, or permuted, column */
int p2 = Ap[kk+1];
for (int p = Ap[kk]; p < p2; p++)
for (int p = Ap[kk]; p < p2; ++p)
{
/* A (i,k) is nonzero (original or permuted A) */
int i = Pinv ? Pinv[Ai[p]] : Ai[p];
@@ -226,7 +226,7 @@ void SparseLDLT<MatrixType,Backend>::_symbolic(const MatrixType& a)
/* find parent of i if not yet determined */
if (m_parent[i] == -1)
m_parent[i] = k;
m_nonZerosPerCol[i]++; /* L (k,i) is nonzero */
++m_nonZerosPerCol[i]; /* L (k,i) is nonzero */
tags[i] = k; /* mark i as visited */
}
}
@@ -234,7 +234,7 @@ void SparseLDLT<MatrixType,Backend>::_symbolic(const MatrixType& a)
}
/* construct Lp index array from m_nonZerosPerCol column counts */
Lp[0] = 0;
for (int k = 0; k < size; k++)
for (int k = 0; k < size; ++k)
Lp[k+1] = Lp[k] + m_nonZerosPerCol[k];
m_matrix.resizeNonZeros(Lp[size]);
@@ -265,7 +265,7 @@ bool SparseLDLT<MatrixType,Backend>::_numeric(const MatrixType& a)
const int* Pinv = 0;
bool ok = true;
for (int k = 0; k < size; k++)
for (int k = 0; k < size; ++k)
{
/* compute nonzero pattern of kth row of L, in topological order */
y[k] = 0.0; /* Y(0:k) is now all zero */
@@ -274,7 +274,7 @@ bool SparseLDLT<MatrixType,Backend>::_numeric(const MatrixType& a)
m_nonZerosPerCol[k] = 0; /* count of nonzeros in column k of L */
int kk = (P) ? (P[k]) : (k); /* kth original, or permuted, column */
int p2 = Ap[kk+1];
for (int p = Ap[kk]; p < p2; p++)
for (int p = Ap[kk]; p < p2; ++p)
{
int i = Pinv ? Pinv[Ai[p]] : Ai[p]; /* get A(i,k) */
if (i <= k)
@@ -293,20 +293,20 @@ bool SparseLDLT<MatrixType,Backend>::_numeric(const MatrixType& a)
/* compute numerical values kth row of L (a sparse triangular solve) */
m_diag[k] = y[k]; /* get D(k,k) and clear Y(k) */
y[k] = 0.0;
for (; top < size; top++)
for (; top < size; ++top)
{
int i = pattern[top]; /* pattern[top:n-1] is pattern of L(:,k) */
Scalar yi = y[i]; /* get and clear Y(i) */
y[i] = 0.0;
int p2 = Lp[i] + m_nonZerosPerCol[i];
int p;
for (p = Lp[i]; p < p2; p++)
for (p = Lp[i]; p < p2; ++p)
y[Li[p]] -= Lx[p] * yi;
Scalar l_ki = yi / m_diag[i]; /* the nonzero entry L(k,i) */
m_diag[k] -= l_ki * yi;
Li[p] = k; /* store L(k,i) in column form of L */
Lx[p] = l_ki;
m_nonZerosPerCol[i]++; /* increment count of nonzeros in col i */
++m_nonZerosPerCol[i]; /* increment count of nonzeros in col i */
}
if (m_diag[k] == 0.0)
{

View File

@@ -163,7 +163,7 @@ class SparseMatrix
}
assert(m_outerIndex[outer+1] == m_data.size());
int id = m_outerIndex[outer+1];
m_outerIndex[outer+1]++;
++m_outerIndex[outer+1];
m_data.append(0, inner);
return m_data.value(id);
@@ -192,7 +192,7 @@ class SparseMatrix
assert(m_outerIndex[outer+1] == m_data.size() && "invalid outer index");
int startId = m_outerIndex[outer];
int id = m_outerIndex[outer+1]-1;
m_outerIndex[outer+1]++;
++m_outerIndex[outer+1];
m_data.resize(id+2);
while ( (id >= startId) && (m_data.index(id) > inner) )
@@ -212,7 +212,7 @@ class SparseMatrix
// find the last filled column
while (i>=0 && m_outerIndex[i]==0)
--i;
i++;
++i;
while (i<=m_outerSize)
{
m_outerIndex[i] = size;
@@ -299,7 +299,7 @@ class SparseMatrix
// FIXME the above copy could be merged with that pass
for (int j=0; j<otherCopy.outerSize(); ++j)
for (typename _OtherCopy::InnerIterator it(otherCopy, j); it; ++it)
m_outerIndex[it.index()]++;
++m_outerIndex[it.index()];
// prefix sum
int count = 0;