Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cirq.plot_density_matrix outputs buggy plots (abstract art) and doesn't scale with number of qubits. #4804

Closed
tanujkhattar opened this issue Jan 5, 2022 · 3 comments · Fixed by #4805
Labels
area/visualization kind/bug-report Something doesn't seem to work.

Comments

@tanujkhattar
Copy link
Collaborator

Description of the issue
cirq.plot_density_matrix is buggy and output's random plots (tested in a colab) and would also doesn't scale well with number of qubits.

My guess is that this due to the magic numbers hardcoded in the code, which should be changed and computed on the fly based on the size of the density matrix.

_half_cell_size_after_padding = (1 / 1.1) * 0.5

How to reproduce the issue

import cirq
cirq.plot_density_matrix(cirq.testing.random_density_matrix(dim=4, random_state = 12345))

image

Cirq version
0.14.0.dev20220105215702

cc @AnimeshSinha1309

@tanujkhattar tanujkhattar added the kind/bug-report Something doesn't seem to work. label Jan 5, 2022
@tanujkhattar tanujkhattar changed the title cirq.plot_density_matrix outputs random plots and doesn't scale with number of qubits. cirq.plot_density_matrix outputs buggy plots and doesn't scale with number of qubits. Jan 5, 2022
@dabacon
Copy link
Collaborator

dabacon commented Jan 6, 2022

It does look like some sort of abstract art, though :)

@tanujkhattar tanujkhattar changed the title cirq.plot_density_matrix outputs buggy plots and doesn't scale with number of qubits. cirq.plot_density_matrix outputs buggy plots (abstract art) and doesn't scale with number of qubits. Jan 6, 2022
@tanujkhattar
Copy link
Collaborator Author

@dabacon Updated the title to better reflect what's happening :P

AnimeshSinha1309 added a commit to AnimeshSinha1309/contrib-cirq that referenced this issue Jan 6, 2022
The plotting positions were dividing by cell size instead of multiplying, fixed that.
@AnimeshSinha1309
Copy link
Contributor

I have no idea how all the multiply operations were written as divide, I had made the mistake but I remember that things were working last I checked. Anyways, fixed this, please lemme know if stuff is working now. Not sure if adding a test here would help, maybe I can add that radius of any circle should not be more than 1 and same with with length of any line.

CirqBot pushed a commit that referenced this issue Jan 7, 2022
The plotting positions were dividing by cell size instead of multiplying, fixed that.
Closes #4804.
MichaelBroughton pushed a commit to MichaelBroughton/Cirq that referenced this issue Jan 22, 2022
The plotting positions were dividing by cell size instead of multiplying, fixed that.
Closes quantumlib#4804.
rht pushed a commit to rht/Cirq that referenced this issue May 1, 2023
The plotting positions were dividing by cell size instead of multiplying, fixed that.
Closes quantumlib#4804.
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this issue Oct 31, 2024
The plotting positions were dividing by cell size instead of multiplying, fixed that.
Closes quantumlib#4804.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/visualization kind/bug-report Something doesn't seem to work.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants