quri_parts.qulacs.circuit package#
- convert_gate(gate)#
- Parameters:
gate (QuantumGate) –
- Return type:
QuantumGateBase
- convert_circuit(circuit)#
- Parameters:
circuit (NonParametricQuantumCircuit) –
- Return type:
QuantumCircuit
- convert_parametric_circuit(circuit)#
- Parameters:
circuit (UnboundParametricQuantumCircuitProtocol) –
- Return type:
tuple[ParametricQuantumCircuit, Callable[[Sequence[float]], Sequence[float]]]
- compile_circuit(circuit)#
Compiles a quri-parts circuit into an ImmutableQuantumCircuit that holds the corresponding qulacs circuit on memory. The qulacs circuit can be accessed by the .qulacs_circuit property.
Example:
>>> circuit = QuantumCircuit(2) >>> circuit.add_X_gate(0) >>> circuit.add_X_gate(1)
Get compiled circuit
>>> compiled_circuit = compile_circuit(circuit) >>> compiled_qulacs_circuit = compiled_circuit.qulacs_circuit
- Parameters:
circuit (NonParametricQuantumCircuit) –
- Return type:
_QulacsCircuit
- compile_parametric_circuit(circuit)#
Compiles a:
- quri-parts UnboundParametricQuantumCircuit into an
ImmutableUnboundParametricQuantumCircuit that holds the corresponding qulacs parametric circuit on memory.
- quri-parts LinearMappedUnboundParametricQuantumCircuit into an
ImmutableUnboundParametricQuantumCircuit that holds the corresponding qulacs parametric circuit on memory.
The qulacs circuit can be accessed by the .qulacs_circuit property.
The parameter mapper that maps the quri-parts circuit parameters to qulacs parametric circuit parameters can be accessed by the .param_mapper property.
Example:
>>> parametric_circuit = UnboundParametricQuantumCircuit(2) >>> parametric_circuit.add_ParametricRX_gate(0) >>> parametric_circuit.add_ParametricRX_gate(1)
Get compiled parametric circuit
>>> compiled_parametric_circuit = compile_circuit(circuit) >>> compiled_qulacs_circuit = compiled_circuit.qulacs_circuit
Get qulacs circuit parameters
>>> param_mapper = compiled_circuit.param_mapper >>> quri_parts_circuit_param = [0, 1] >>> qulacs_circuit_param = param_mapper(quri_parts_circuit_param)
- Parameters:
circuit (UnboundParametricQuantumCircuit | LinearMappedUnboundParametricQuantumCircuit) –
- Return type:
_QulacsUnboundParametricCircuit | _QulacsLinearMappedUnboundParametricCircuit
- circuit_from_qulacs(qulacs_circuit)#
Converts a
qulacs.QuantumCircuit
toNonParametricQuantumCircuit
.- Parameters:
qulacs_circuit (QuantumCircuit) –
- Return type: