def sparse_mean_var(data):
    """
    Calculates the variance for each row of a sparse matrix,
    using the relationship Var = E[x^2] - E[x]^2.

    Returns:
        pair of matrices mean, variance.
    """
    data = sparse.csc_matrix(data)
    return sparse_means_var_csc(data.data,
            data.indices,
            data.indptr,
            data.shape[1],
            data.shape[0])