Cody

# Problem 43007. Euclidean inter-point distance matrix

Solution 1373022

Submitted on 8 Dec 2017 by Jean-Marie Sainthillier
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
A = eye(3); y_correct = (1-A)*sqrt(2); tol = 10*eps; assert(norm(interDist(A)-y_correct) < tol)

2   Pass
A = (1:4)'; y_correct = [ 0 1 2 3;... 1 0 1 2;... 2 1 0 1;... 3 2 1 0]; tol = 10*eps; assert(norm(interDist(A)-y_correct) < tol)

3   Pass
A = magic(3); y_correct = [0 6.48074069840786 9.79795897113271; ... 6.48074069840786 0 6.48074069840786; ... 9.79795897113271 6.48074069840786 0]; tol = 1000*eps; assert(norm(interDist(A)-y_correct) < tol)

4   Pass
A = reshape((1:20).^2,4,5); tol = 1e-12; y_correct = [0 49.4469412603045 102.761860629321 160.015624237135; ... 49.4469412603045 0 53.3385414123783 110.634533487515; ... 102.761860629321 53.3385414123783 0 57.3149195236284; ... 160.015624237135 110.634533487515 57.3149195236284 0]; assert(norm(interDist(A)-y_correct) < tol)