function _dot(x, y) {
    var xSize = size(x);
    var ySize = size(y);
    var len = xSize[0];
    if (xSize.length !== 1 || ySize.length !== 1) throw new RangeError('Vector expected'); // TODO: better error message

    if (xSize[0] !== ySize[0]) throw new RangeError('Vectors must have equal length (' + xSize[0] + ' != ' + ySize[0] + ')');
    if (len === 0) throw new RangeError('Cannot calculate the dot product of empty vectors');
    var prod = 0;

    for (var i = 0; i < len; i++) {
      prod = add(prod, multiply(x[i], y[i]));
    }

    return prod;
  }
Calculate the dot product for two arrays
@param {Array} x  First vector
@param {Array} y  Second vector
@returns {number} Returns the dot product of x and y
@private