Java Array Normalize norm2(double[] x)

Here you can find the source of norm2(double[] x)

Description

norm

License

Open Source License

Declaration

public static double norm2(double[] x) 

Method Source Code

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

public class Main {
    public static double norm2(double[] x) {
        double result = innerProduct(x, x);
        return Math.pow(result, 0.5);
    }/*www  .  j  a v  a  2s .co  m*/

    public static double innerProduct(double[] x1, double[] x2) {

        double result = 0;
        for (int i = 0; i < x1.length; i++) {
            if (x1[i] == 0.0D || x2[i] == 0.0D)
                continue;
            result += x1[i] * x2[i];
        }

        return result;
    }
}

Related

  1. norm(final double[] x)
  2. norm(float[] data)
  3. norm(int D, double vec[])
  4. norm2(double[] vec)
  5. norm2(double[] vector)
  6. norm2DoubleArray(double[] v)
  7. norm_variance(double[] array)
  8. norm_vec(double[] vec)
  9. normal0(double[] p1, double[] p2, double[] p3)