I am trying to create a function in Qiskit that, given an integer n, returns a circuit of that size in which all qubits at the output are entangled together in a maximally-entangled state.

Some examples:

|001⟩ -> (|001⟩ + |110⟩)/√(2)

|010⟩ -> (|100⟩ + |011⟩)/√(2)

|100⟩ -> (|000⟩ - |111⟩)/√(2)

|101⟩ -> (|001⟩ - |110⟩)/√(2)

|111⟩ -> (|010⟩ - |101⟩)/√(2)

I have written the following function in Qiskit to build a basic maximally entangled circuit:

import qiskit

def maximally_entangled_state(n: int):

        qr = qiskit.QuantumRegister(n)
        #cr = qiskit.ClassicalRegister(6)
        circuit = qiskit.QuantumCircuit(qr)#, cr)

        circuit.cx(qr[0], qr[1])

        if n>2:
          for item in range(2 , n):
             circuit.cx(qr[0], qr[item])

        return circuit

that returns such a circuit:

circuit = maximally_entangled_state(4)

enter image description here

I do not know how to investigate the examples and add relevant quantum gates to my code.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.