def perpendicular_vector(v):
    """
    Compute a vector perpendicular to the input vector
    """
    if v[0] == v[1] == v[2] == 0:
        raise ValueError('zero-vector')
    if v[2] == 0:
        return [-v[1], v[0], 0]
    else:
        return [1.0, 1.0, -1.0 * (v[0] + v[1]) / v[2]]
