v5.0.0
What's Changed
Added
get_purityin*FockStatefor calculating the purity.PostSelectPhotonsandImperfectPostSelectPhotonsforPureFockSimulatorand
SamplingSimulator.Beamsplitter5050support.SamplingState.state_vector, analog of*FockState.state_vector.- JAX support for
SamplingSimulator. - Support for multiple occupation numbers in
SamplingSimulator. PureFockState.get_particle_detection_probability_on_modes, which is similar to
get_particle_detection_probability, but for the specified modes.HomodyneMeasurementsupport forPureFockSimulator.cvqnn.get_cvqnn_weight_indicesis created, which enables slicing of the weights when
needed.PureFockState.variance_photon_numberfor calculating the variance of the photon
number operator.- Partial JAX support for
GaussianSimulator. GaussianState.get_threshold_detection_probability.- Python 3.12 support.
- Support for
ParticleNumberMeasurementinGaussianSimulatorwith the config
use_torontonian=Trueand displaced Gaussian states. Config.validateflag. If set tovalidate=False, validations are skipped, possibly
enabling minor speed-up or JIT compilation.piquasso.fermionicpackage with support for fermionic Gaussian states.- Support for differentiable
GaussianState.get_particle_detection_probability.
Fixed
Simulator.executewithinitial_statespecified while usingtf.function.GaussianSimulatorrandom number generation fromConfig.rng.- Error message formatting in
Simulator. Beamsplitterdefault parameters.fock_probabilitiesdifferentiability inPureFockSimulator.SamplingState.fock_probabilitiesreturns with probabilities corresponding to all
particle number sectors.
Breaking changes
- Delete unused attributes in
SamplingState. - Clements decomposition rewritten.
- The original RNG is kept when a
Configis copied. This is done to prevent unexpected
behaviour with seeded calculations. - The config variable
Config.normalizeis deleted. For the same result, one can call
State.normalizeat the end of the calculations. Simulator._default_calculator_classinitial value got deleted to avoid confusion.- Renamed
CalculatortoConnectorand corresponding names containing the term
calculator, referring to the originalCalculatorclass (e.g.,
_default_calculator_class->_default_connector_class). BaseConnector(formerBaseCalculator) rewritten as an abstract class.- Added/updated
__repr__methods for all classes in the Piquasso API.
Performance improvements
- Hafnian, loop hafnian, torontonian and permanent implementations replaced with faster
implementations. The torontonian calculation is written in C++, and is distributed in
the wheels alongside the Python code. - Faster
FockState.norm. - Faster
SamplingState.get_particle_detection_probability. - JIT compilation of passive linear gates in
*FockSimulator. - Common Fock-space related calculations got rewritten, JIT compilation enabled.
- More efficient sampling algorithms for BS and GBS simulations.
New Contributors
- @czaba7 made their first contribution in #307
- @dependabot made their first contribution in #355
Full Changelog: 4.0.0...v5.0.0