def METHOD_NAME(data, indices, indptr, major_len, minor_len, dtype):
    """
    Computes mean and variance for a sparse array for the major axis.
    Given arrays for a csr matrix, returns the means and variances for each
    row back.
    """
    means = np.zeros(major_len, dtype=dtype)
    variances = np.zeros_like(means, dtype=dtype)
    for i in range(major_len):
        startptr = indptr[i]
        endptr = indptr[i + 1]
        counts = endptr - startptr
        for j in range(startptr, endptr):
            means[i] += data[j]
        means[i] /= minor_len
        for j in range(startptr, endptr):
            diff = data[j] - means[i]
            variances[i] += diff * diff
        variances[i] += (minor_len - counts) * means[i] ** 2
        variances[i] /= minor_len
    return means, variances