pypi StrawberryFields 0.18.0
Release 0.18.0

latest releases: 0.21.0, 0.20.0, 0.19.0...
3 years ago

New features since last release

  • Adds the Bosonic backend, which can simulate states represented as linear combinations of Gaussian functions in phase space. (#533) (#538) (#539) (#541) (#546) (#549)

    It can be regarded as a generalization of the Gaussian backend, since transformations on states correspond to modifications of the means and
    covariances of each Gaussian in the linear combination, along with changes to the coefficients of the linear combination. Example states that can be expressed using the new backend include all Gaussian, Gottesman-Kitaev-Preskill,
    cat and Fock states.

    prog = sf.Program(1)
    eng = sf.Engine('bosonic')
    
    with prog.context as q:
        sf.ops.GKP(epsilon=0.1) | q
        sf.ops.MeasureX | q
    
    results = eng.run(prog, shots=200)
    samples = results.samples[:, 0]
    
    plt.hist(samples, bins=100)
    plt.show()
  • Adds the sf.ops.GKP operation, which allows the Gottesman-Kitaev-Preskill state to be initialized on both the Bosonic and Fock backends. (#553) (#546)

    GKP states are qubits, with the qubit state defined by:

    image

    where the computational basis states are

    image

  • Adds the measurement-based squeezing gate MSgate; a new front-end operation for the Bosonic backend. (#538) (#539) (#541)

    MSgate is an implementation of inline squeezing that can be performed by interacting the target state with an ancillary squeezed vacuum state at a beamsplitter, measuring the ancillary mode with homodyne, and then applying a feed-forward displacement. The channel is implemented either on average (as a Gaussian CPTP map) or in the single-shot implementation. If the single-shot implementation is used, the measurement outcome of the ancillary mode is stored in the results object.

    prog = sf.Program(1)
    eng = sf.Engine('bosonic')
    
    with prog.context as q:
        sf.ops.Catstate(alpha=2) | q
        r = 0.3
        # Average map
        sf.ops.MSgate(r, phi=0, r_anc=1.2, eta_anc=1, avg=True) | q
        # Single-shot map
        sf.ops.MSgate(r, phi=0, r_anc=1.2, eta_anc=1, avg=False) | q
    
    results = eng.run(prog)
    ancilla_samples = results.ancilla_samples
    
    xvec = np.arange(-5, 5, 0.01)
    pvec = np.arange(-5, 5, 0.01)
    wigner = results.state.wigner(0, xvec, pvec)
    
    plt.contourf(xvec, pvec, wigner)
    plt.show()
  • The tf backend now accepts the Tensor DType as argument. (#562)

    Allows high cutoff dimension to give numerically correct calculations:

    prog = sf.Program(2)
    eng  = sf.Engine("tf", backend_options={"cutoff_dim": 50, "dtype": tf.complex128})
    with prog.context as q:
        Sgate(0.8) | q[0]
        Sgate(0.8) | q[1]
        BSgate(0.5,0.5) | (q[0], q[1])
        BSgate(0.5,0.5) | (q[0], q[1])
    state = eng.run(prog).state
    N0, N0var = state.mean_photon(0)
    N1, N1var = state.mean_photon(1)
    print(N0)
    print(N1)
    print("analytical:", np.sinh(0.8)**2)

Improvements

  • Program compilation has been modified to support the XQC simulation service, Simulon. (#545)

  • The sympmat, rotation_matrix, and haar_measure functions have been removed from backends/shared_ops.py. These functions are now imported from The Walrus. In addition, various outdated functionality from the shared_ops.py file has been removed, including the caching of beamsplitter and squeezing pre-factors. (#560) (#558)

  • Sample processing in the TDMProgram is now more efficient, by replacing calls to pop with fancy indexing. (#548)

  • No VisibleDeprecationWarning is raised when using the state wigner method. (#564)

  • The backend utility module shared_ops.py has been removed, with all of its functionality now provided by The Walrus. (#573)

Breaking changes

  • Removes support for Python 3.6. (#573)

Bug fixes

  • Connection objects now send requests to the platform API at version 0.2.0 instead of the incorrect version number 1.0.0. (#540)

  • TDM programs now expect a flat (not nested) dictionary of modes in device specifications obtained from the XQC platform API. (#566)

  • Fixes a bug in the CatState operation, whereby the operation would return incorrect results for a high cutoff value. (#557) (#556)

Documentation

  • The "Hardware" quickstart page has been renamed to "Xanadu Quantum Cloud" to encompass both hardware and cloud simulators. A new "Cloud simulator" entry has been added, describing how to submit programs to be executed via the XQC simulator. (#547)

  • Cleanup docs to make contribution easier. (#561)

  • Add development requirements and format script to make contribution easier. (#563)

Contributors

This release contains contributions from (in alphabetical order):

J. Eli Bourassa, Guillaume Dauphinais, Ish Dhand, Theodor Isacsson, Josh Izaac, Leonhard Neuhaus, Nicolás Quesada, Aaron Robertson, Krishna Kumar Sabapathy, Jeremy Swinarton, Antal Száva, Ilan Tzitrin.

Don't miss a new StrawberryFields release

NewReleases is sending notifications on new releases.