How to parallel this code?
Ältere Kommentare anzeigen
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 Kommentare
tao jiang
am 7 Okt. 2016
Walter Roberson
am 7 Okt. 2016
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.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Sparse Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!