def cvxopt_maxdiff(A, B):
    """Return the largest absolute difference of two (sparse) CVXOPT matrices.

    :raises TypeError: If the matrices are not of the same shape.
    """
    if A.size != B.size:
        raise TypeError('The matrices do not have the same shape.')
    if not A and not B:
        return 0.0
    return max(abs(A - B))
