Main Content

observable

Measurements in Pauli basis

Since R2024b

    Installation Required: This functionality requires MATLAB Support Package for Quantum Computing.

    Description

    An observable object represents a set of measurements in the Pauli basis, which corresponds to X, Y, and Z on the Bloch sphere. You can use an observable object to calculate the expected value of a quantum circuit or state in the specified basis.

    For more information about observables, see Observable.

    Creation

    Description

    o = observable(paulis,weights) creates a set of measurements in the specified Pauli basis with the corresponding weights.

    example

    o = observable(hermitian) computes the equivalent Pauli basis and corresponding weights from the specified Hermitian matrix and the uses the basis and weights to create a set of measurements.

    example

    Input Arguments

    expand all

    Pauli basis measurements, specified as a string vector or character matrix. Specify the elements of paulis as combinations of "X", "Y", "Z", or "I", where the jth character of an element indicates the specified measurement basis on the jth qubit.

    Every element of paulis must have n characters, where n is the number of qubits in the quantum circuit or gate. paulis must have the same number of elements as weights.

    This argument sets the Paulis property.

    Weights of the Pauli basis measurements, specified as a real numeric vector. weights must have the same number of elements as paulis.

    This argument sets the Weights property.

    Hermitian matrix, specified as a square matrix of size 2n-by-2n, where n is the number of qubits in the quantum circuit or state.

    Output Arguments

    expand all

    Set of measurements in the Pauli basis, returned as an observable object.

    Properties

    expand all

    This property is read-only.

    Pauli basis measurements, represented as a string vector. The elements of paulis are combinations of "X", "Y", "Z", or "I", where the jth character of an element indicates the specified measurement basis on the jth qubit.

    Every element of Paulis has n elements, where n is the number of qubits in the quantum circuit or gate. The Paulis vector has the same number of elements as the Weights vector.

    This property is read-only.

    Weights of the Pauli basis measurements, represented as a real numeric vector. The Weights vector has the same number of elements as the Paulis vector.

    This property is read-only.

    Number of qubits in the quantum circuit or state, represented as a positive integer scalar.

    Object Functions

    getMatrixMatrix representation of observable

    Examples

    collapse all

    Create an observable from a two-qubit Pauli basis measurement where the X measurement basis is observed on the first and second qubits with weight 2.4 and the Z measurement basis is observed on the first qubit with weight –1.2.

    o = observable(["XX" "ZI"],[2.4 -1.2])
    o = 
      observable with properties:
    
           Paulis: [2×1 string]
          Weights: [2×1 double]
        NumQubits: 2
    
    

    Create an observable from a 4-by-4 Hermitian matrix.

    H = [-1 0 0 2;
        0 -1 2 0;
        0 2 1 0;
        2 0 0 1];
    o = observable(H)
    o = 
      observable with properties:
    
           Paulis: [2×1 string]
          Weights: [2×1 double]
        NumQubits: 2
    
    

    Examine the Pauli basis measurements and weights of the observable. The X measurement basis is observed on the first and second qubits with weight 2 and the Z measurement basis is observed on the first qubit with weight –1.

    paulis = o.Paulis
    paulis = 2×1 string
        "XX"
        "ZI"
    
    
    weights = o.Weights
    weights = 2×1
    
         2
        -1
    
    

    More About

    expand all

    Version History

    Introduced in R2024b

    Go to top of page