def hat(k):
    """Converts a 3-vector to an anti-sym matrix """
    import numpy as np
    A = np.zeros((3, 3))
    A[0, 1] = -k[2]
    A[0, 2] = k[1]
    A[1, 2] = -k[0]
    A = A - A.transpose()
    return A
