Here you can find the source of sum(final double[] vec)
Parameter | Description |
---|---|
array | the array, to be summed. |
public static double sum(final double[] vec)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w ww. j a v a 2s . co m * Computes the sum of the elements of a vector. * @param array the array, to be summed. * @return the sum of the elements of the vector. */ public static double sum(final double[] vec) { assert vec != null; double s = 0; for (double i : vec) { s += i; } return s; } }