`contract_partially` only allows full contraction
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
Research direction
Start by locating PauliPropagator::contract_partially and its tests, then trace how build_graph groups Majorana operators and gates into contraction slices. The examples specify that a shorter parameter list should work when contractions are independent, but should raise an error when the final gate cannot be contracted; add coverage for both cases and run the relevant test suite.
Written by the indexing model from the issue text.
Description
Right now it seems you can only contract fully or all Majoranas at once. This is not bad per se , but one could think of being able to contract only part of the graph, example:
from monoprop import Circuit, ExpGate, Pauli, PauliOperator, PauliPropagator
# "new possible feature" example
circuit = Circuit(
[
ExpGate(PauliOperator({Pauli("X"): 1.0}, num_qubits=4)),
ExpGate(PauliOperator({Pauli("Z"): 1.0}, num_qubits=4)),
]
)
prop = PauliPropagator(PauliOperator({Pauli("YIII"): 1.0}, num_qubits=4), [], cutoff=6)
prop.build_graph(circuit)
# prop.contract_partially([0.4, 0.5], inplace=True) #OK and available currently
prop.contract_partially([0.4], inplace=True) # throws error
This approach requires one a check: if Majorana operators are correlated but separate d by other gates, you cannot contract with only one parameter (e.g. contraction happens in slices)
from __future__ import annotations
from monoprop import Circuit, ExpGate, Pauli, PauliOperator, PauliPropagator
# "Problematic" example
circuit = Circuit(
[
ExpGate(PauliOperator({Pauli("X"): 1.0}, num_qubits=4), 0),
ExpGate(PauliOperator({Pauli("Z"): 1.0}, num_qubits=4), 1),
ExpGate(PauliOperator({Pauli("X"): 1.0}, num_qubits=4), 0),
]
)
prop = PauliPropagator(PauliOperator({Pauli("YIII"): 1.0}, num_qubits=4), [], cutoff=6)
prop.build_graph(circuit)
# prop.contract_partially([0.4, 0.5], inplace=True) #OK
prop.contract_partially(
[0.4], inplace=True
) # should raise error as we can't contract last gate!
- Dominant language
- C++
- Stars
- 52
- Forks
- 2
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 22
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Algorithmiq/monoprop
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Algorithmiq/monoprop#193 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Algorithmiq/monoprop#192 ·
Maintainers usually reply within 1 day
-
bug performance
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Algorithmiq/monoprop#191 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Algorithmiq/monoprop#189 ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 4/5 3-5 days Newbie friendliness 44/100
Algorithmiq/monoprop#442 ·
Maintainers usually reply within 1 day
All issues in Algorithmiq/monoprop
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
? - Needs Triage bot_watch bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NVIDIA/cudf-spark-jni#5594 ·
Maintainers usually reply within 1 day
-
Branch-master
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
TrinityCore/TrinityCore#32177 ·
Maintainers usually reply within 10 days
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
mw00/project-maya#1499 ·
Maintainers usually reply within 2 days
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day