我正在寻找以下matlab函数的适当矢量化,以消除for循环并通过多线程提高速度。
size(A)
= N
-by- N
,其中30 <= N <= 60
1e4 <= numIter <= 1e6
function val=permApproxStochSquare(A,numIter)
%// A ... input square non-negative matrix
%// numIter ... number of interations
N=size(A,1);
alpha=zeros(numIter,1);
for curIter=1:numIter
U=randn(N,N);
B=U.*sqrt(A);
alpha(curIter)=det(B)^2;
end
val=mean(alpha);
end