Here you can find the source of dotProduct(double[] array, int[] indices, double[] values)
public static double dotProduct(double[] array, int[] indices, double[] values)
//package com.java2s; public class Main { public static double dotProduct(double[] array, int[] indices, double[] values) { double result = 0; for (int i = 0; i < indices.length; i++) { if (indices[i] == -1) continue; result += array[indices[i]] * values[i]; }//from www . j a v a2 s . c o m return result; } }