def inverse(A):
    """For A affine 2D represented as 6vec return 6vec version of A**(-1)"""
    det = float(A[0] * A[3] - A[2] * A[1])
    R = [A[3] / det, -A[1] / det, -A[2] / det, A[0] / det]
    return tuple(R + [-R[0] * A[4] - R[2] * A[5], -R[1] * A[4] - R[3] * A[5]])
