Open nvyin opened 8 years ago
Hi @nvyin. Sorry you're having trouble, but I'm not sure what you are trying to do. Are you trying to write a java program that performs the same operations as this javascript module?
Dear Zeke,
I am trying to get results which are same as matlab one, the java code that i posted does not produce same result for example distance result in matlab is 0.02 , but in java is 19 ?? i do not know why :(
is the code that iam using have a bug which i not seeing it :(
@zeke the matlab Norm() manipulating the difference in size and array type in way i do not know i how ? please do you understand my aim ??
public static double norm(double[][] dataSet, double[][][] s_pos, int cent, int part, int data_vector) { // Matlab code // distance(data_vector,1)=norm(s_pos(cent,:,part)-Data(data_vector,:))
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////// convert 3D to 1D ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// int rows = s_pos.length; int columns = s_pos[0].length; int depth = s_pos[0][0].length;
public static double [] convert2dTo1dArray2(double[][] array2d){ double[] result = new double[array2d.length * array2d[0].length];
for (int i = 0; i < d11.length; i++) { squaredSum += Math.pow(d11[i] - d22[i], 2); } return Math.sqrt(squaredSum);
The results are so big compared to matlab function :(