Java Array Normalize norm(double[] v)

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

Description

returns the norm of the vector

License

Open Source License

Declaration

public static double norm(double[] v) 

Method Source Code

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

public class Main {
    /** returns the norm of the vector*/
    public static double norm(double[] v) {
        return (Math.sqrt(dotprod(v, v)));
    }/*from   w ww  .  j  a  v  a 2 s  .c o m*/

    /** computes the dot product v1*v2.*/
    public static double dotprod(double[] v1, double[] v2) {
        return (v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2]);
    }
}

Related

  1. norm(double[] a)
  2. norm(double[] a)
  3. norm(double[] a)
  4. norm(double[] array)
  5. norm(double[] data)
  6. norm(double[] vector)
  7. norm(double[] vector, int n)
  8. norm(final double[] vec)
  9. norm(final double[] x)