使用 Wiedemann/Krylov 方法求解线性方程

计算科学 matlab 线性代数
2021-12-16 23:09:39

在此处输入图像描述 让给
M=

 1     0     1
 0     1     1
 1     1     1

b=

 1
 0
 1

如何找到解决方案x3在哪里x={x1,x2,x3}?

解决方案:基于 Wiedemann 算法,我们有ui=[0;0;1]. 我在Step2中感到困惑。怎么找Ms? 难道只是3thMt作为Ms=[111]或者它是从 Krylov 序列创建的? 请帮我找到 M_s 和最小多项式?

Matlab代码:

%% Input Generation Matrix M, b and index ith
%% Output single symbol x
M=[1 0 1;0 1 1;1 1 1];
b=[1; 0; 1];
index=2;
[K N]=size(M);
Mt=M';
Imatrix=eye(K,K);
x=[];
for index=1:K
u_i=Imatrix(:,index);
se_Krylov=[];
se_Krylov(:,1)=u_i;
    for i=2:(2*K) % due to i=1 is u_i
       se_Krylov(:,i)=mod((Mt^i)*u_i,2);
    end
%% M_s is the operator Mt retricted to S    
M_s=se_Krylov(index,:);

%% Compute the polynominal using Berlekmap Massey
[f, LCP] = Berlekamp_Massey2(M_s);
d=size(f,2)-1; %deg of f: x^d+x^(d-1)+....

x_comma=zeros(K,1);
    for i=d:-1:1
        x_comma=mod(x_comma+f(d).*(Mt)^(i-1)*u_i,2);
    end
x_single=mod(x_comma'*b,2) ;%Inner product 
x(index)=x_single;
end
0个回答
没有发现任何回复~