'How Can I Calculate Dissimilarity of Two Matrices on Java?

I want to calculate dissimilarity matrix of two arrays in Java but could not find out how to do that. There are a method in Matlab as "pdist2" and it works well for me but when I want to implement that in Java I could not do that.

Two matrices-arrays in java are like this:

double[][] x = new double[][]{{1.0, 2.0},{3.0, 4.0}};
double[][] y = new double[][]{{3.0, 4.0},{5.0, 6.0}};

I want to find that:

double[][] xyDissimilarity = pdist2(x, y);

Is there any Java code or library for that?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source