I have a matrix d representing distances.
I need to find B=X'X
X=matrix that generated these distances.+

B[i,j]=-(1/2)*{[d[i,j]^2-[(1/n)*sum for i=1...n(d[i,j])^2]-[(1/n)sum for
j=1...n(d[i,j])^2]+[(1/n^2)sum for i=1...n sum for j=1...n (d[i,j])^2]}

it's right if i do
B=matrix(,nrow=dim(d)[1],ncol=dim(d)[2])
for (i in 1:dim(d)[1])
for (j in 1:dim(d)[2]){
B=(-(1/2))*(d[i,j]^2-d[i,]^2-d[,j]^2+d[,]^2)
}
or i have to put
B[i,j]=(-(1/2))*(d[i,j]^2-d[i,]^2-d[,j]^2+d[,]^2)
??

	[[alternative HTML version deleted]]

