def nuclear_norm(data):
    r"""Nuclear norm

    This method computes the nuclear (or trace) norm of the input data.

    Parameters
    ----------
    data : np.ndarray
        Input data array

    Returns
    -------
    float nuclear norm value

    Examples
    --------
    >>> from modopt.math.matrix import nuclear_norm
    >>> a = np.arange(9).reshape(3, 3)
    >>> nuclear_norm(a)
    15.49193338482967

    Notes
    -----
    Implements the following equation:

    .. math::
        \|\mathbf{A}\|_* = \sum_{i=1}^{\min\{m,n\}} \sigma_i (\mathbf{A})

    """

    # Get SVD of the data.
    u, s, v = np.linalg.svd(data)

    # Return nuclear norm.
    return np.sum(s)