List of utility methods to do Matrix Square
double[] | sqr(double[] a, double res[]) sqr for (int i = 0; i < a.length; i++) { res[i] = a[i] * a[i]; return res; |
float | sqrdist(float[] a, float[] b) sqrdist float sum = 0; for (int i = 0; i < a.length; i++) { float diff = a[i] - b[i]; sum += diff * diff; return sum; |
float | sqrEuclidianDist(float[] p, float[] q) Squared Euclidian distance of p and q. float sum = 0; for (int i = 0; i < p.length; i++) { sum += (p[i] - q[i]) * (p[i] - q[i]); return sum; |
double[] | sqrt(double[] v) sqrt double[] newv = new double[v.length]; for (int i = 0; i < v.length; i++) newv[i] = Math.sqrt(v[i]); return newv; |
void | sqrt(double[] vector) sqrt for (int i = 0; i < vector.length; i++) vector[i] = Math.sqrt(vector[i]); |