-
Notifications
You must be signed in to change notification settings - Fork 18
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 changed initial_state
kwarg to be density matrix
#101
Conversation
Codecov Report
@@ Coverage Diff @@
## master #101 +/- ##
===========================================
+ Coverage 0.00% 99.23% +99.23%
===========================================
Files 8 8
Lines 379 391 +12
===========================================
+ Hits 0 388 +388
+ Misses 379 3 -376
Continue to review full report at Codecov.
|
initial_state
kwarg to be density matrix
pennylane_cirq/simulator_device.py
Outdated
def _convert_to_density_matrix(self, state_vec): | ||
"""Convert ``state_vec`` into a density matrix.""" | ||
dim = 2**self.num_wires | ||
return np.kron(state_vec, state_vec.conj()).reshape((dim, dim)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is moved, but the MixedStateSimulatorDevice
inherits from the base SimulatorDevice
so both classes have access to this helper function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for fixing the tests, it looks good to me! 💯
[sc-17246] |
When calling the
simulator.simulate(circuit)
method forcirq.DensityMatrixSimulator()
simulator (and all mixed state simulators I assume), the kwarginitial_state=None
was previously passed as a state vector. Now it is required that this quantity be passed as a density matrix.The unit tests were updated to make use of this functionality. No other changes required