def dense(x, w, b, phi):
    """Computes a dense layer operation on the input data.

    This function implements a single dense layer for a neural network. The
    input data is dotted with the weights vector. The bias is added to the
    output. Finally, the activation function is run over the data and the
    result is returned.

    Parameters
    ----------
    x : numpy.ndarray
        Input data.
    w : numpy.ndarray
        Weights vector.
    b : numpy.ndarray
        Bias vector.
    phi : function
        Activation function to apply to the output.

    Returns
    -------
    numpy.ndarray
        Output of the dense layer.
    """
    return phi(x @ w + b)