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

Separable CH-form #4828

Closed
daxfohl opened this issue Jan 12, 2022 · 0 comments · Fixed by #4844
Closed

Separable CH-form #4828

daxfohl opened this issue Jan 12, 2022 · 0 comments · Fixed by #4844
Labels
area/clifford-simulator area/simulation kind/feature-request Describes new functionality triage/discuss Needs decision / discussion, bring these up during Cirq Cynque

Comments

@daxfohl
Copy link
Collaborator

daxfohl commented Jan 12, 2022

Is your feature request related to a use case or problem? Please describe.

State vector and density matrix both can run separable states independently, allowing for exponential speedup when the state is not fully entangled. This can be done in CH-form as well, though it would be linear speedup.

Describe the solution you'd like

CH-form is represented with a couple of n*n matrices, some n-length vectors, and a phase. I believe that kronning two of these is as follows: for the matrices you kron a m*m matrix with an n*n matrix you create a (m+n)*(m+n) matrix, place the m*m values in the top-left, and the n*n values in the bottom right. To kron the vectors, you just concat them, and then you multiply the two phases. I'm fairly sure that's all there is to it, though obviously this needs tested thoroughly (even better, confirm mathematically).

There's no easy way to factor a CH-form that I can see. Reversing the above doesn't work because the matrices don't necessarily zero-out the top-right and bottom-left after measurement. Maybe there's some way of doing this though. But in absence of that we can add an ActOnArgs.can_factor that returns False by default, override that in SV and DM simulators to return True, and then check that value in ActOnArgsContainer.act_on_fallback before attempting to factor the result.

There's always the potential that the overhead of these operations could slow simulation down more than they speed them up, in the nominal fully-entangled cases. I'd not particularly expect any of this to add noticeable overhead, but obviously that should be tested.

Could be a good first/second issue for the adventurous.

What is the urgency from your perspective for this issue? Is it blocking important work?

P3 - I'm not really blocked by it, it is an idea I'd like to discuss / suggestion based on principle

@daxfohl daxfohl added the kind/feature-request Describes new functionality label Jan 12, 2022
@daxfohl daxfohl mentioned this issue Jan 12, 2022
@viathor viathor added triage/discuss Needs decision / discussion, bring these up during Cirq Cynque area/clifford-simulator area/simulation labels Jan 12, 2022
CirqBot pushed a commit that referenced this issue Jan 26, 2022
Closes #4828

I did verify that it is consistent across a large set of random circuits. There does seem to be some overhead, ~10%, in non-separable states so I left the default behavior as not to separate states. However I also verified there's a roughly linear speedup when the states are separable.
rht pushed a commit to rht/Cirq that referenced this issue May 1, 2023
Closes quantumlib#4828

I did verify that it is consistent across a large set of random circuits. There does seem to be some overhead, ~10%, in non-separable states so I left the default behavior as not to separate states. However I also verified there's a roughly linear speedup when the states are separable.
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this issue Oct 31, 2024
Closes quantumlib#4828

I did verify that it is consistent across a large set of random circuits. There does seem to be some overhead, ~10%, in non-separable states so I left the default behavior as not to separate states. However I also verified there's a roughly linear speedup when the states are separable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/clifford-simulator area/simulation kind/feature-request Describes new functionality triage/discuss Needs decision / discussion, bring these up during Cirq Cynque
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants