API documentation

class pytket.extensions.pennylane.pytket_device.PytketDevice(wires, shots=None, pytket_backend=<pytket.extensions.qiskit.backends.aer.AerStateBackend object>, optimisation_level=None, compilation_pass=None)[source]

PytketDevice allows pytket backends and compilation to be used as Pennylane devices.

analytic_probability(wires=None)[source]

See pennylane.devices._qubit_device.QubitDevice.analytic_probability()

Return type:

ndarray

apply(operations, rotations=None)[source]

See pennylane.devices._qubit_device.QubitDevice.apply()

Return type:

None

capabilities()[source]

See pennylane.devices._qubit_device.QubitDevice.capabilities()

Return type:

dict[str, Any]

compile(circuit)[source]
Return type:

Circuit

generate_samples()[source]

See pennylane.devices._qubit_device.QubitDevice.generate_samples()

Return type:

ndarray

reset()[source]

Reset the backend state.

After the reset, the backend should be as if it was just constructed. Most importantly the quantum state is reset to its initial value.

Return type:

None

run(compiled_c)[source]

Run the compiled circuit, and query the result.

Return type:

None

pytket.extensions.pennylane.pennylane_convert.pennylane_to_tk(operations, wire_map, qreg, creg, measure=False)[source]

Convert a PennyLane circuit to a pytket circuit

Parameters:
Return type:

Circuit

Returns:

pytket circuit

pytket.extensions.pennylane.pennylane_convert.apply_operations(operations, wire_map, qreg)[source]

Apply the circuit operations.

This method serves as an auxiliary method to apply().

Parameters:

operations (List[pennylane.operation.Operation]) – operations to be applied

Return type:

list[Circuit]

Returns:

A list of tket circuit objects that specify the corresponding operations