def construct_QMF_ansatz(n_qubits): b = [Variable(name='beta_{}'.format(i)) for i in range(n_qubits)] g = [Variable(name='gamma_{}'.format(i)) for i in range(n_qubits)] def euler_rot(beta, gamma, q0): return gates.Rx(target=q0, angle=beta) + gates.Rz(target=q0, angle=gamma) for i in range(n_qubits): if i == 0: U = euler_rot(b[i], g[i], i) else: U += euler_rot(b[i], g[i], i) return U
def construct_QCC_ansatz(entanglers): #entanglers must be a list of OpenFermion QubitOperators #Returns the QCC unitary circuit ansatz t = [Variable(name='tau_{}'.format(i)) for i in range(len(entanglers))] for i in range(len(entanglers)): if i == 0: U = gates.ExpPauli(paulistring=PauliString.from_openfermion( list(list(entanglers[i].terms.keys())[0])), angle=t[i]) else: U += gates.ExpPauli(paulistring=PauliString.from_openfermion( list(list(entanglers[i].terms.keys())[0])), angle=t[i]) return U