Skip to content

one major on missing some key operator like cz and one minor on readme  #19

@kwccoin

Description

@kwccoin

Minor: On the section about "Working with Individual States and gates", one minor issue is that the qc has to be either "qc.reset()" or redefine "qc = ...". I suspect the other issue can be handled.

Major: try to reproduce the circuit of teleport from quirk to composer. It can be done on the IBM openqasm 2.0 composer but not here. The issue is that there is no cz operator. I suspect one can amend these lines but not sure I am expert enough to try.

                ...
		cnot_re=re.compile('^cx (q\[[0-4]\]), (q\[[0-4]\])$')      # <-- need to change to (x|y|z)
		for l in lines:
			l=l.strip()
			if not l: continue
			# CNOT operates on two qubits so gets special processing
			cnot=cnot_re.match(l)
			if cnot:
				control_qubit=cnot.group(1)  #<-- group(2)
				target_qubit=cnot.group(2)   #<-- group(3)
                                # depends upon group(1) and feed group(1) into the function
				l='self.apply_two_qubit_gate_CNOT(%s,%s'%(control_qubit,target_qubit) #<-- major change needed
			for k,v in translation:
				l=l.replace(k,v)
			l=l+')'
			# Now running the code
			exec(l,globals(),locals())
                        ...

Somehow the cx in the first line need to increase to cover cy and cz and then apply the appropriate logic to it (the line l="..." for the "translation".

The regular expression might be easily fixed by changing into something like

cnot_re=re.compile('^c(x|y|z} (q\[[0-4]\]), (q\[[0-4]\])$')

and some change in logic of the "if cnot" so to use group 2 and 3 not 1 and 2 and use group 1 to handle cx/cy/cz

But the logic under self.apply_two_qubit_gate_CNOT is not that easy as it involved different way to handle cx/cy/cz gate change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions