Java Array Normalize norm(double[] a)

Here you can find the source of norm(double[] a)

Description

vector 2-norm

License

Open Source License

Parameter

Parameter Description
a vector of length 3

Return

norm(a)

Declaration

public static double norm(double[] a) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*from   w ww . j  ava  2 s.co m*/
     * vector 2-norm
     *
     * @param a vector of length 3
     * @return norm(a)
     */
    public static double norm(double[] a) {
        double c = 0.0;

        for (double num : a) {
            c += num * num;
        }

        return Math.sqrt(c);
    }
}

Related

  1. norm(byte[] tab)
  2. norm(double[] a)
  3. norm(double[] a)
  4. norm(double[] array)
  5. norm(double[] data)
  6. norm(double[] v)