arasyi/quantum-api-drift huggingface dataset:
Task: Create a custom 2-qubit gate with an X gate on qubit 0 and an H gate on qubit 1. Then, add two control qubits to this gate. Apply this controlled gate to a 4-qubit circuit, using qubits 0 and 3 as controls and qubits 1 and 2 as targets. Return the final circuit.
You must implement this using a function named `create_custom_controlled` with no arguments.
Function to implement: create_custom_controlled
Tests:
from qiskit import QuantumCircuit
candidate_circuit = create_custom_controlled()
assert isinstance(candidate_circuit, QuantumCircuit)
assert candidate_circuit.num_qubits == 4
assert len(candidate_circuit.data) > 0
Task: Create a quantum circuit using LieTrotter for a list of Pauli strings and times. Each Pauli string is associated with a corresponding time in the 'times' list. The function should return the resulting QuantumCircuit.
You must implement this using a function named `create_product_formula_circuit` with the following arguments: pauli_strings, times, reps.
Function to implement: create_product_formula_circuit
Tests:
from qiskit import QuantumCircuit
pauli_strings = ["X", "Y", "Z"]
times = [1.0, 2.0, 3.0]
reps = 1
candidate_circuit = create_product_formula_circuit(pauli_strings, times, reps)
assert isinstance(candidate_circuit, QuantumCircuit)
assert candidate_circuit.num_qubits == 1
assert len(candidate_circuit.data) > 0
Task: Synthesize an evolution gate using MatrixExponential for a given Pauli string and time.
The Pauli string can be any combination of 'I', 'X', 'Y', and 'Z'.
Return the resulting QuantumCircuit.
You must implement this using a function named `synthesize_evolution_gate` with the following arguments: pauli_string, time.
Function to implement: synthesize_evolution_gate
Tests:
from qiskit import QuantumCircuit
qc = synthesize_evolution_gate("X", 1.0)
assert isinstance(qc, QuantumCircuit)
assert qc.num_qubits == 1
assert len(qc.data) > 0