Matlab 矩阵的Drazin逆

Matlab 矩阵的Drazin逆,matlab,matrix,linear-algebra,Matlab,Matrix,Linear Algebra,是否有一种算法可以计算奇异矩阵的平均值?我想在MATLAB或Mathematica中应用它 阅读本文: 布凡斌、魏益民,,应用数学与计算147.3(2004):805-836 在附录中有几个MATLAB代码。第一个是: function DrazinInverse1a = DrazinInverse1(a) %----------------------------------------- %Compute the Drazin Inverse of a matrix 'a' using th

是否有一种算法可以计算奇异矩阵的平均值?我想在
MATLAB
Mathematica
中应用它

阅读本文:

布凡斌、魏益民,,应用数学与计算147.3(2004):805-836

在附录中有几个MATLAB代码。第一个是:

function DrazinInverse1a = DrazinInverse1(a)
%-----------------------------------------
%Compute the Drazin Inverse of a matrix 'a' using the limited algorithm.
%Need computing the index of 'a'.
global q1 q2 s1 s2
[m,n] = size(a);
if m~= n
    disp('Matrix is must be square!')
end
%-----------------------------------------
% Computer the index of A and note r = rank(A^k).
[k,r,a1,a] = index(a);
F = eye(n);
g = -trace(a);
g = collect(g);
for i = 1:r-1
    G = g*eye(n);
    F = a*F+G;
    g = -trace(a*F)/(i+1);
    g = collect(g);
end
DrazinInverse1a = a1*F;
DrazinInverse1a = -1/g*DrazinInverse1a;
DrazinInverse1a = simplify(DrazinInverse1a);
end

function [k,r,a1,a] = index(a)
%To compute the index of 'a'.
k = 0;
n = length(a);
r = n;
a0 = a;
r1 = rank(a);
a1 = eye(n);
while r ~= r1
    r = r1;
    a1 = a;
    a = a*a0;
    r1 = rank(a);
    k = k+1;
end
r = sym2poly(r);
end

关于MathOverflow可能会有兴趣。是的,我见过,但因为它似乎很旧,我假设现在会有一个MATLAB或Mathematica代码,可以非常有效地计算奇异矩阵的
Drazin逆
。@thanasissdr取决于矩阵的大小和时间限制,你可以用a来计算。@TroyHaskin好的,我来查一查。谢谢。虽然此链接可以回答问题,但最好在此处包含答案的基本部分,并提供链接供参考。如果链接页面发生更改,仅链接的答案可能无效。@emmanuel,我已经添加了主体代码。校样很长,它的剪贴不正确。