code: public static double scalarProduct( double[] a, double[] b ) {
          double c = 0;
          for( int i = 0; i < a.length; i++ ) {
              c = c + a[i] * b[i];
          }
          return c;
      }
docs: Compute the dot product.
  
  @param a
  is a vector.
  @param b
  is a vector.
  @return the dot product of a and b.