Here you can find the source of norm2(double[] vector)
Parameter | Description |
---|---|
Vector | A double[x,y] |
public static double norm2(double[] vector)
//package com.java2s; //License from project: Apache License public class Main { /**// w w w. j av a 2 s.co m * Get the norm of a 2 dimension vector * @param Vector A double[x,y] * @return the norm */ public static double norm2(double[] vector) { return distance(vector, new double[] { 0, 0 }); } /** * Measure distance between a and b * @param Point A double[x,y] * @param Point B double[x,y] * @return distance between A and B */ public static double distance(double[] a, double[] b) { return Math.sqrt(Math.pow(a[0] - b[0], 2) + Math.pow(a[1] - b[1], 2)); } }