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

add CP map #243

Merged
merged 3 commits into from
Jul 31, 2020
Merged

add CP map #243

merged 3 commits into from
Jul 31, 2020

Conversation

corryvrequan
Copy link
Contributor

@corryvrequan corryvrequan commented Jul 16, 2020

I've added CP-map for the advanced use of an irreversible map.

from qulacs.gate import CP, P0, H
from qulacs import QuantumState
p0 = P0(0)
# If true, state is normalized if Kraus operator is applied.
# If not, state is left unnormalized.
state_normalize = True 
# If true, probability distribution is normalized to unity.
# If not, no Kraus operator may be matched when the map is trace decreasing.
probability_normalize = False
# If true, return zero-filled vector when no Kraus operator is matched.
# If not, return the original input state when no Kraus operator is matched.
# This parameter is meaningless if you set probability_normalize = true.
assign_zero_if_not_matched = True

gate = CP([p0], state_normalize, probability_normalize, assign_zero_if_not_matched)

qs = QuantumState(1)
H(0).update_quantum_state(qs)
gate.update_quantum_state(qs)

@corryvrequan
Copy link
Contributor Author

This is checked by a person who proposed this issue. So, this is self-merged.

@corryvrequan corryvrequan merged commit 75d107c into qulacs:dev Jul 31, 2020
kotamanegi pushed a commit to kotamanegi/qulacs that referenced this pull request Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant