-
Hi, I'm not sure if this issue has been raised. I'm running this example here, and I find that my samples are generally correlated. Given that the example has the following diagram, I would expect that the samples are not correlated. Please let me know if I'm doing something wrong.
from cuquantum.cutensornet.experimental import NetworkState, NetworkOperator
import cupy as cp
state = NetworkState((2, 2), dtype='complex128')
bitflip_channel = [
cp.eye(2, dtype='complex128'), # I
cp.asarray([[0, 1], [1, 0]], dtype='complex128') # X
]
bitflip_probabilities = [0.5, 0.5] # 5% for bitflip
# apply one body tensor operators & unitary channels to the tensor network state
for i in range(len(state.state_mode_extents)):
modes_one_body = (i, )
channel_id = state.apply_unitary_tensor_channel(modes_one_body, bitflip_channel, bitflip_probabilities)
state.compute_sampling(nshots=1000, release_workspace=True) Expected output:
Actual: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hello, What you observed is expected. When unitary tensor channels exist in the system, each time In your case with 2 bitflip channels, the final state may collapse into 4 potential state, each with a probability of 25% and the returned sample will correspond to one of the potential state as you see. If you want to sample all states, one more external loop is needed, e.g, n_states_to_sample = 100
n_shots_per_sample = 1000
all_samples = {}
for i in range(n_n_states_to_sample):
samples = state.compute_samples(n_shots_per_sample)
all_samples.update(samples)
print(all_samples) Please note that |
Beta Was this translation helpful? Give feedback.
Hello,
What you observed is expected. When unitary tensor channels exist in the system, each time
NetworkState.compute_xxxx
(xxxx being a target property, e.g, sampling, expectation, etc) is called, a particular state of all potential state will be sampled, and then the property will be computed on top of that sampled state.In your case with 2 bitflip channels, the final state may collapse into 4 potential state, each with a probability of 25% and the returned sample will correspond to one of the potential state as you see.
If you want to sample all states, one more external loop is needed, e.g,