Here you can find the source of norm2(double[] vec)
Parameter | Description |
---|---|
vec | a parameter |
public static double norm2(double[] vec)
//package com.java2s; //License from project: Open Source License public class Main { /**/*ww w . j av a2 s . c om*/ * returns the norm2 of an array * @param vec * @return */ public static double norm2(double[] vec) { double result = 0.0; for (int i = 0; i < vec.length; ++i) result += Math.pow(vec[i], 2); return Math.pow(result, 0.5); } }