hybridlane.measurements.state

Classes

StateMP

Interface for all measurements that operate directly on (classically-simulated) statevectors

Functions

state([wires])

State measurement process.

Module Contents

hybridlane.measurements.state.state(wires=None)[source]

State measurement process. Analogous to Pennylane’s state measurement (qml.state()), but the logic of this measurement process should be handled by the device since the state is entirely dependent on the fock cutoffs set by the device.

Attention

The device level implementation should preserve Pennylane’s lexicographical ordering – ie the ‘top’ wire is the most significant bit in the statevector.

Examples

def circuit():
    hqml.FockState(  # set mode 1 to fock state 1 using qubit 0 as ancilla
        1, [0, 1]
    )
    hqml.FockState(  # set mode 2 to fock state 2 using qubit 0 as ancilla
        2, [0, 2]
    )
    return hqml.state()

The returned statevector should correspond to the state \(\lvert 0,1,2 \rangle\) (with cutoffs of 2,4,4) so the state \(\lvert 0,1,2 \rangle\) corresponds to the index 6 in the statevector (since (0)*4*4 + (1)*4 + (2)*1 = 6).

Parameters:

wires (Wires | None)

Return type:

StateMP