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

ProjectQ – Error messages

1  Asked on March 7, 2021 by marija-scekic

 

Problems with Q# installing

2  Asked on February 28, 2021 by brockenduck

 

Q# installation on Heroku

1  Asked on February 28, 2021 by shadab-hussain

   

Can quantum computers be used to solve P = NP

1  Asked on February 27, 2021 by peter-morgan

 

Ask a Question

Get help from others!

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