List of utility methods to do Vector Sum
double[] | vectorSum(final double[] vecOne, final double[] vecTwo) Sums up two vectors. if (vecOne == null || vecTwo == null) { throw new IllegalArgumentException("vector 'vecOne' or 'vecTwo' == null!"); if (vecOne.length != vecTwo.length) { throw new IllegalArgumentException( "The vectors differs in length!( " + vecOne.length + " != " + vecTwo.length); double[] ret = new double[vecOne.length]; ... |
int | vectorSum(int[] vector) vector Sum int sum = 0; for (int i = 0; i < vector.length; i++) sum += vector[i]; return sum; |