我想计算 2 个矩阵的元素之间的差异:示例:
s1 = tuple[0][0]-vector[0][0]+tuple[0][1]-vector[0][1]
s2 = tuple[0][0]-vector[1][0]+tuple[0][1]-vector[1][1]
s3 = tuple[0][0]-vector[2][0]+tuple[0][1]-vector[2][1]
static double Distance1(double[][] tuple, double[][] vector)
{
double sumSquaredDiffs =0.0;
int i;
int j;
for(i=0; i<tuple.length;i++)
for(j=0; j<vector.length; j++){
sumSquaredDiffs = tuple[i][0] - vector[j][0]+ tuple[i][1] - vector[j][1];
}
return sumSquaredDiffs;
}
}
我希望结果如下所示:
13.0
125.0
123.0
10.0
122.0
120.0
有人可以帮我纠正这个功能吗?