Java Distance Calculate distortion(double[] xvalues, double[] yvalues, int[] include)

Here you can find the source of distortion(double[] xvalues, double[] yvalues, int[] include)

Description

Returns the sum of the squared difference of xvalues and yvalues for non-zero include index values

License

Open Source License

Declaration

public static double distortion(double[] xvalues, double[] yvalues, int[] include) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/* w  w  w. j  av a  2s.c o  m*/
     * Returns the sum of the squared difference of xvalues and yvalues for non-zero 
     * include index values
     */
    public static double distortion(double[] xvalues, double[] yvalues, int[] include) {
        double ddiff;
        double dsumsq = 0;

        for (int nindex = 0; nindex < include.length; nindex++) {
            if (include[nindex] != 0) {
                ddiff = (xvalues[nindex] - yvalues[nindex]);
                dsumsq += ddiff * ddiff;
            }
        }

        return dsumsq;
    }
}

Related

  1. distHalf(double angA, double angB)
  2. distHaversineRAD(double lat1, double lon1, double lat2, double lon2)
  3. distinctFrom(String string, String other)
  4. distL1(double[] h1, double[] h2)
  5. distL1(int[] h1, int[] h2)
  6. distpl(double A, double B, double C, double x, double y)
  7. distPointLineSigned(double px, double py, double qx, double qy, double rx, double ry)
  8. distPointLineSquared(double px, double py, double qx, double qy, double rx, double ry)
  9. distPointSegmentSquared(double px, double py, double qx, double qy, double rx, double ry)