How to parallel this code?
古いコメントを表示
function d = compute_d(vertex)
%vertex is nvert by 3 matrix;
nvert= max(size(vertex));
d = [];
for i = 1:nvert-1
for j = i+1:nvert
x_ij = vertex(i,:) - vertex(j,:);
d = [d; x_ij/norm(x_ij)];
end
end
save('d', 'd');
2 件のコメント
tao jiang
2016 年 10 月 7 日
Walter Roberson
2016 年 10 月 7 日
The object your store into, d, cannot have an index that complicated. You should switch to a linear index that you then break up into i and j.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Sparse Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!