Here you can find the source of sumValuesSquared(double[] vector)
Parameter | Description |
---|---|
vector | a parameter |
public static double sumValuesSquared(double[] vector)
//package com.java2s; public class Main { /**/*w w w .ja va 2s.com*/ * Compute the sum of values squared in an array * @param vector * @return the sum of all values */ public static double sumValuesSquared(double[] vector) { double sum = 0; for (double v : vector) sum += v * v; return sum; } /** * Compute the sum of values squared in an array * @param vector * @return the sum of all values */ public static float sumValuesSquared(float[] vector) { float sum = 0; for (float v : vector) sum += v * v; return sum; } /** * Compute the sum of values squared in an array * @param vector * @return the sum of all values */ public static int sumValuesSquared(int[] vector) { int sum = 0; for (int v : vector) sum += v * v; return sum; } /** * Compute the sum of values squared in an array * @param vector * @return the sum of all values */ public static int sumValuesSquared(byte[] vector) { int sum = 0; for (int v : vector) sum += v * v; return sum; } /** * Compute the sum of values squared in an array * @param vector * @return the sum of all values */ public static int sumValuesSquared(short[] vector) { int sum = 0; for (int v : vector) sum += v * v; return sum; } /** * Compute the sum of values squared in an array * @param vector * @return the sum of all values */ public static long sumValuesSquared(long[] vector) { long sum = 0; for (long v : vector) sum += v * v; return sum; } }