def H2(state, qubit):
    """
    Applies a Hadamard gate (H4) rotation to stabilizers and destabilizers

    X - Z

    X -> -Z
    Z -> -X
    W -> -W
    Y -> -Y
    """
    stabs = state.stabs
    stabs.signs_minus ^= stabs.col_x[qubit] | stabs.col_z[qubit]
    for gens in state.gen_list:
        xonly = gens.col_x[qubit] - gens.col_z[qubit]
        zonly = gens.col_z[qubit] - gens.col_x[qubit]
        for i in xonly:
            gens.row_x[i].discard(qubit)
            gens.row_z[i].add(qubit)
        for i in zonly:
            gens.row_z[i].discard(qubit)
            gens.row_x[i].add(qubit)
        gens.col_x[qubit], gens.col_z[qubit] = gens.col_z[qubit], gens.col_x[
            qubit]
