Skip to content

Abstract analog backend functions

BaseQuTiPObservablesParser

Convert InputType object to Qutip native quantum objects for simulation on QuTiP.

It is intended to be used on the expectation method of Pulser-based interface classes. InputType can be qadence2-expressions expression or any other module with the same methods.

build(num_qubits, observables) classmethod

Parses an input expression or list of expressions into a native QuTiP object.

PARAMETER DESCRIPTION
num_qubits

the number of qubits to create the qutip object to

TYPE: int

observables

the input expression. Any qadence2-expressions expression compatible object, with the same methods

TYPE: (list[InputType], InputType)

RETURNS DESCRIPTION
list[Qobj]

A QuTiP object with the Hilbert space compatible with num_qubits

Source code in qadence2_platforms/backends/_base_analog/functions.py
@classmethod
def build(cls, num_qubits: int, observables: list[InputType] | InputType) -> list[qutip.Qobj]:
    """
    Parses an input expression or list of expressions into a native QuTiP object.

    Args:
        num_qubits (int): the number of qubits to create the qutip object to
        observables (list[InputType], InputType): the input expression. Any
            qadence2-expressions expression compatible object, with the same
            methods

    Returns:
        A QuTiP object with the Hilbert space compatible with `num_qubits`
    """
    if not isinstance(observables, list):
        return [cls._get_op(num_qubits, observables)]
    return cls._iterate_over_obs(num_qubits, observables)

base_parse_native_observables(num_qubits, observable)

Function to be called by Interface's expectation method on Pulser-based backends using QuTiP emulator.

PARAMETER DESCRIPTION
num_qubits

number of qubits

TYPE: int

observable

the input expression. Any qadence2-expressions expression compatible object, with the same methods, or a list of it

TYPE: list[InputType] | InputType

RETURNS DESCRIPTION
list[Qobj]

A QuTiP object with the Hilbert space compatible with num_qubits

Source code in qadence2_platforms/backends/_base_analog/functions.py
def base_parse_native_observables(
    num_qubits: int, observable: list[InputType] | InputType
) -> list[qutip.Qobj]:
    """
    Function to be called by `Interface`'s `expectation` method on Pulser-based backends
    using QuTiP emulator.

    Args:
        num_qubits (int): number of qubits
        observable (list[InputType] | InputType): the input expression. Any
            qadence2-expressions expression compatible object, with the same
            methods, or a list of it

    Returns:
        A QuTiP object with the Hilbert space compatible with `num_qubits`
    """
    return BaseQuTiPObservablesParser.build(num_qubits, observable)