pennylane.transpiler#

Qamomile to Pennylane Transpiler Module

This module provides functionality to convert Qamomile Hamiltonians to their Pennylane equivalents. It includes a PennylaneTranspiler class that implements the QuantumSDKTranspiler interface for Pennylane compatibility.

Key Features: - Convert Qamomile Hamiltonians to Pennylane Hamiltonians.

Usage Example:

```python from qamomile.Pennylane.transpiler import PennylaneTranspiler

transpiler = PennylaneTranspiler() pennylane_operator = transpiler.transpile_hamiltonian(qamomile_hamiltonian) ```

Requirements: - Qamomile - Pennylane

Classes#

PennylaneTranspiler

A transpiler class for converting Qamomile Hamiltonians to Pennylane-compatible Hamiltonians.

Module Contents#

class PennylaneTranspiler#

Bases: qamomile.core.transpiler.QuantumSDKTranspiler[tuple[collections.Counter[int], int]]

A transpiler class for converting Qamomile Hamiltonians to Pennylane-compatible Hamiltonians.

transpile_hamiltonian(operator: qamomile.core.operator.Hamiltonian) pennylane.Hamiltonian#

Converts a Qamomile Hamiltonian to a Pennylane Hamiltonian.

Parameters:

operator (qamomile.core.operator.Hamiltonian) – The Qamomile Hamiltonian to be converted.

Returns:

The corresponding Pennylane Hamiltonian.

Return type:

qml.Hamiltonian

transpile_circuit(qamomile_circuit: qamomile.core.circuit.QuantumCircuit) Any#

Convert a Qamomile quantum circuit to a PennyLane-compatible function (QNode construction by user).

Parameters:

qamomile_circuit (qamomile.core.circuit.QuantumCircuit) – The Qamomile quantum circuit to convert.

Returns:

A PennyLane-compatible function which applies the circuit.

Return type:

Callable

convert_result(result: Dict[str, int]) qamomile.core.bitssample.BitsSampleSet#

Convert a dictionary of results from PennyLane execution to a Qamomile-compatible BitsSampleSet.

Parameters:

result (Dict[str, int]) – A dictionary where each key is a binary string consisting of ‘0’ and ‘1’ (representing measurement outcomes), and each value is the corresponding count.

Returns:

A Qamomile BitsSampleSet object.

Return type:

BitsSampleSet