-
Notifications
You must be signed in to change notification settings - Fork 62
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
Question/Bug: Not able to apply channel correctly #144
Comments
Thank you for the report and for flagging this. Indeed, your workflow here seems to make sense. My first thought is that perhaps there is some normalization condition that needs to be considered within the If you have any other test cases and information to share about what you are doing here that might shine light on where the issue is, that would be much obliged. Thanks again for flagging. |
Thanks for the response. My use case is pretty simple. Mainly I just want to generate different values of |
It's also possible that one could try the same |
Would this approach make sense?
Maybe again my mistake, but the second to last line throws an exception:
|
Hmm. I actually think the import numpy as np
from toqito import (
channel_ops,
channels,
matrix_props
)
# Define the Bell state.
test_input_mat = np.array(
[[1 / 2, 0, 0, 1 / 2], [0, 0, 0, 0], [0, 0, 0, 0], [1 / 2, 0, 0, 1 / 2]]
)
# The depolarizing channel should map every density operator to the maximally mixed state.
res = channel_ops.apply_channel(test_input_mat, channels.depolarizing(4))
# Returns `False`.
print(matrix_props.is_density(res)) We should not expect the result of this to be a density operator by definition, right? Maybe my brain isn't working properly right now, but this is my current train of thought anyway. In any case, the Kraus approach definitely seems to need fixing. The input there should be a list of two lists representing the Kraus ops. One would expect that the |
For me, a channel should be CPTP, and therefore would map density operators to density operators. An application of a channel should, in my understanding, result in a state which is the channel effect applied to the input state. I use other tools like Pennylane, for example ,which have built in depolarizing channels. I can do an input-output fidelity pretty easily with that so that's why I was expecting I could do an input/output fidelity check of the before state and the state after the channel is applied. Do you think there is a way to do that here? Thanks for the help and time. |
Hi @stephendiadamo . Thanks for continuing the thread here. Hmm, let's see. The Now, certainly, as you say, your intuition there aligns with mine, that is, applying a CPTP map to a density operator should give you a density operator right back. I presume that QETLAB does not have this issue and works as expected (although I don't have a MATLAB license to verify this). In this case, there is probably an issue with the way that the Line 38 in ApplyMap has quite a lot going on that could be easily messed up in the I can attempt to spend some time trying to figure out what the difference is here, but without a MATLAB license, that might be tricky. Alternatively, I suppose we could consider |
Hi @vprusso, thanks for all that info. I don't know if Pennylane would be the best choice yet... I mainly use depolarizing channels in my work and it happens to have that built in. For arbitrary channels, I'm not sure if it supports that. I think it very well could though. I'll have a look to see if it could be used. I also don't have a MATLAB licence, but maybe I can figure out a way to get one. Let's see. For now, since I'm again using a depolarizing channel for two qubits, I just used matrix operations as a workaround. |
Hi @stephendiadamo. Thank you for the update and your patience on the matter. I'm glad you found a workaround, but indeed, this is something I will be prioritizing fixing. As UnitaryHack is approaching, I think this would be an excellent issue for someone to triage and squash. Thank you again for flagging this, and if I can lend a hand in any other way in using |
Tagging @georgios-ts here so I can assign them to claim the bounty for UnitaryHack. |
Pinging @stephendiadamo on the above issue. Thanks to the work of @georgios-ts, this issue that you pointed out should be fixed. Thank you again to @stephendiadamo for bringing this issue up and to @georgios-ts for the, as usual, outstanding work and contribution. Cheers! |
Thank you @vprusso and @georgios-ts for the help and addressing my issue. |
@vprusso |
Expected Behavior
I'm trying to apply a channel to a state, but the channel is not preserving the trace. Could I be using the functions incorrectly or is there a bug? Thanks.
Specifications
The text was updated successfully, but these errors were encountered: