1

When I try to transpile circuit with Qiskit, I can use 'ry' as a basis gate. But I want to set one of the basis gate as $R_y(\pi/2)$. How can I do that?

Edited:

my_z2 = QuantumCircuit(1,name='z2')
my_z2.rz(np.pi,0)
z2_def = QuantumCircuit(1)
z2_def.append(my_z2.to_gate(),[0])
StandardEquivalenceLibrary.add_equivalence(RZGate(np.pi), z2_def)

qc = QuantumCircuit(1) qc.rz(np.pi,0) qc_trans = transpile(qc, basis_gates=['id','z2'],translation_method='translator') qc_trans.draw('mpl')

This is my code and it throws CircuitError: CircuitError: 'Cannot bind parameters (rz[0]) not present in the circuit.'

How can I fix this?

glS
  • 27,510
  • 7
  • 37
  • 125
Inm
  • 535
  • 3
  • 9

0 Answers0