AnswerBun.com

How to change the names of the registers displayed with circuit_drawer (output='mpl')

Quantum Computing Asked by tribluralux on December 17, 2020

I am trying to change the appearance of the circuit_drawer in output=’mpl’ mode. The registers of the Quantum Circuit are named like ($q0_0$, $q0_1$, $q1_0$, $q2_0$, $q2_1$,..) but I’d like to name them myself. I can’t find a style function or option which is able to do that… any ideas?

To be clear what I would like to change:

enter image description here

One Answer

When initializing the registers for the quantum circuit you need to set the parameter 'name'. For example:

f_in = QuantumRegister(n, name='f_in')
###add other registers here### 
qc = QuantumCircuit(f_in, ...)
qc.draw(ouput='mpl')

Gives the output:

enter image description here

Answered by tribluralux on December 17, 2020

Add your own answers!

Related Questions

Where to publish quantum algorithm related paper

2  Asked on August 20, 2021 by zzy1130

   

Defining a Grassmann Algebra in Python

0  Asked on August 20, 2021 by callum

   

Geometric interpretation of 1-distillability

0  Asked on August 20, 2021 by sanchayan-dutta

     

What is the general matrix for the Swap gate?

1  Asked on August 20, 2021 by victory-omole

   

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP