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!