c# – 对矩阵进行Howellizing

我试图以 this paper (google docs link) (link to the pdf)第5页所述的方式实现一个算法来对一个矩阵进行Howellize.

我认为,大部分内容都非常明显,但我不确定第16行,是否>>意味着右转?如果是的话,它甚至如何工作?当然这意味着比特被砍掉了?据我所知,目前无法保证它正在转移的数字正在转移一个保留信息的数量.
如果它不意味着正确的转变,它意味着什么?

如果有人可以节省时间,我也想要一个测试用例(我不相信自己想出一个,我不太了解它).

我已经像这样实现了,这是正确的吗? (我没有测试用例,所以如何找到?)

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],d);
        }
        if (r[i] != 1)
            // shifted returns r left-shifted by 32-p
            rows.Add(shifted(r,32 - p));
        j++;
    }
}

解决方法

对于测试用例,this可以为您提供帮助(第2页).也请尝试 this.

我认为你对正确的转变是正确的.要获得Howell表单,他们希望列中除前导值之外的值小于前导值.正确的转变似乎是富有成效的.

第16行说:

Pick d so that 0 <= G(h,i) - d * ri < ri

考虑

G(h,i) - d * ri = 0
         G(h,i) = d * ri
         G(h,i) = d * (2 ^ p)  ... as the comment on line 8 says,ri = 2^p.
         So d = G(h,i) / (2 ^ p)

将p(h,i)右移p位置是计算d值的最快方法.

相关文章

目录简介使用JS互操作使用ClipLazor库创建项目使用方法简单测...
目录简介快速入门安装 NuGet 包实体类User数据库类DbFactory...
本文实现一个简单的配置类,原理比较简单,适用于一些小型项...
C#中Description特性主要用于枚举和属性,方法比较简单,记录...
[TOC] # 原理简介 本文参考[C#/WPF/WinForm/程序实现软件开机...
目录简介获取 HTML 文档解析 HTML 文档测试补充:使用 CSS 选...