Here you can find the source of vector_norm(double[] vec)
public static double vector_norm(double[] vec)
//package com.java2s; //License from project: Apache License public class Main { public static double vector_norm(double[] vec) { double sum = 0; for (double v : vec) sum += v * v;// w w w. j av a2 s .c om return Math.sqrt(sum); } }