def test_random_quadratic(self):
     n_qubits = 5
     quad_ham = random_quadratic_hamiltonian(n_qubits, True)
     ferm_op = get_fermion_operator(quad_ham)
     self.assertTrue(
         jordan_wigner(ferm_op) == jordan_wigner(
             get_diagonal_coulomb_hamiltonian(ferm_op)))
    def test_hubbard(self):
        x_dim = 4
        y_dim = 5
        tunneling = 2.
        coulomb = 3.
        chemical_potential = 7.
        magnetic_field = 11.
        periodic = False

        hubbard_model = fermi_hubbard(x_dim, y_dim, tunneling, coulomb,
                                      chemical_potential, magnetic_field,
                                      periodic)

        self.assertTrue(
            jordan_wigner(hubbard_model) == jordan_wigner(
                get_diagonal_coulomb_hamiltonian(hubbard_model)))
 def __init__(self, hubbard, iterations=1):
     self.hubbard = hubbard
     super().__init__(get_diagonal_coulomb_hamiltonian(
         hubbard.hamiltonian()),
                      iterations=iterations)