/** * This returns the sum of products for the given * numbers. * @param nums the sum of products for the give numbers * @return the sum of products for the given numbers */ public static double sumOfProducts(double[]... nums) { if (nums == null || nums.length < 1) return 0; double sum = 0; for (int i = 0; i < nums.length; i++) { /* The ith column for all of the rows */ double[] column = column(i, nums); sum += times(column); } return sum; }//end sumOfProducts