/** * Returns a new vector whose elements are the elements of the original * vector, divided by the 2-norm of the vector (the square root of the sum * of the squared values of the elements). If the 2-norm is zero (which * means all the elements are zero), then the result is just a duplicate * of the input (zero) vector. * * @param input * The vector to divide by its 2-norm. * @return * A new vector whose elements are the elements from the given vector, * divided by its 2-norm. */ public static Vector divideByNorm2( final Vector input) { final Vector clone = input.clone(); divideByNorm2Equals(clone); return clone; }
/** * Returns a new vector whose elements are the elements of the original * vector, divided by the 2-norm of the vector (the square root of the sum * of the squared values of the elements). If the 2-norm is zero (which * means all the elements are zero), then the result is just a duplicate * of the input (zero) vector. * * @param input * The vector to divide by its 2-norm. * @return * A new vector whose elements are the elements from the given vector, * divided by its 2-norm. */ public static Vector divideByNorm2( final Vector input) { final Vector clone = input.clone(); divideByNorm2Equals(clone); return clone; }
/** * Returns a new vector whose elements are the elements of the original * vector, divided by the 2-norm of the vector (the square root of the sum * of the squared values of the elements). If the 2-norm is zero (which * means all the elements are zero), then the result is just a duplicate * of the input (zero) vector. * * @param input * The vector to divide by its 2-norm. * @return * A new vector whose elements are the elements from the given vector, * divided by its 2-norm. */ public static Vector divideByNorm2( final Vector input) { final Vector clone = input.clone(); divideByNorm2Equals(clone); return clone; }