I m试图采用一种算法,以。 http://research.cs.wisc.edu/wpis/papers/sas11.pdf。
Most of it is pretty obvious to me, I think, but I m not sure about line 16, does >>
mean a right shift there? If it does, then how does it even work? Surely it would mean that bits are being chopped off? As far as I know there s no guarantee at that point that the number it is shifting is being shifted by an amount that preserves the information.
And if it doesn t mean a right shift, what does it mean?
如果任何人都能够节省时间,我也想有一个试办案(我不相信我会到场,我不明白这一点。
我已经这样做了吗? (我没有测试案例,因此我如何发现?)
int j = 0;
for (int i = 0; i < 2 * k + 1; i++)
{
var R = (from row in rows
where leading_index(row) == i
orderby rank(row[i]) ascending
select row).ToList();
if (R.Count > 0)
{
uint[] r = R[0];
int p = rank(r[i]); // rank counts the trailing zeroes
uint u = r[i] >> p;
invert(r, u); // multiplies each element of r by the
// multiplicative inverse of u
for (int s = 1; s < R.Count; s++)
{
int t = rank(R[s][i]);
uint v = R[s][i] >> t;
if (subtract(R[s], r, v << (t - p)) == 0)
// subtracts (v<<(t-p)) * r from R[s],
// removes if all elements are zero
rows.Remove(R[s]);
}
swap(rows, rows.IndexOf(r), j);
for (int h = 0; h < j - 1; h++)
{
uint d = rows[h][i] >> p;
subtract(rows[h], r, d);
}
if (r[i] != 1)
// shifted returns r left-shifted by 32-p
rows.Add(shifted(r, 32 - p));
j++;
}
}