Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync dependencies on develop with main #302

Closed
wants to merge 6 commits into from
Closed

Sync dependencies on develop with main #302

wants to merge 6 commits into from

Conversation

zeyueN
Copy link
Collaborator

@zeyueN zeyueN commented Nov 1, 2023

Context:
The latest post release v0.6.1-post1 contains updated dependencies with unpinned scipy etc. This PR syncs the new dependencies with current develop branch

Description of the Change:

Benefits:

Possible Drawbacks:

Related GitHub Issues:

Before submitting

**Context:**
Relaxes dependency versions in pyproject.toml.

**Description of the Change:**

**Benefits:**

**Possible Drawbacks:**

**Related GitHub Issues:**
@ziofil ziofil marked this pull request as ready for review January 19, 2024 23:36
### New features
* Added a new interface for backends, as well as a `numpy` backend
(which is now default). Users can run
all the functions in the `utils`, `math`, `physics`, and `lab` with both
backends, while `training`
requires using `tensorflow`. The `numpy` backend provides significant
improvements both in import
time and runtime.
[(#301)](#301)

* Added the classes and methods to create, contract, and draw tensor
networks with `mrmustard.math`.
  [(#284)](#284)

* Added functions in physics.bargmann to join and contract (A,b,c)
triples.
  [(#295)](#295)

* Added an Ansatz abstract class and PolyExpAnsatz concrete
implementation. This is used in the Bargmann representation.
  [(#295)](#295)

* Added `complex_gaussian_integral` and `real_gaussian_integral`
methods.
  [(#295)](#295)

* Added `Bargmann` representation (parametrized by Abc). Supports all
algebraic operations and CV (exact) inner product.
  [(#296)](#296)

### Breaking changes
* Removed circular dependencies by:
* Removing `graphics.py`--moved `ProgressBar` to `training` and
`mikkel_plot` to `lab`.
  * Moving `circuit_drawer` and `wigner` to `physics`.
  * Moving `xptensor` to `math`.
  [(#289)](#289)

* Created `settings.py` file to host `Settings`.
  [(#289)](#289)

* Moved `settings.py`, `logger.py`, and `typing.py` to `utils`.
  [(#289)](#289)

* Removed the `Math` class. To use the mathematical backend, replace
`from mrmustard.math import Math ; math = Math()` with `import
mrmustard.math as math`
  in your scripts.
  [(#301)](#301)

* The `numpy` backend is now default. To switch to the `tensorflow`
backend, add the line `math.change_backend("tensorflow")` to your
scripts.
  [(#301)](#301)

### Improvements

* Calculating Fock representations and their gradients is now more
numerically stable (i.e. numerical blowups that
result from repeatedly applying the recurrence relation are postponed to
higher cutoff values).
This holds for both the "vanilla strategy"
[(#274)](#274) and for the
"diagonal strategy" and "single leftover mode strategy"
[(#288)](#288).
This is done by representing Fock amplitudes with a higher precision
than complex128 (countering floating-point errors).
We run Julia code via PyJulia (where Numba was used before) to keep the
code fast.
The precision is controlled by `setting
settings.PRECISION_BITS_HERMITE_POLY`. The default value is ``128``,
which uses the old Numba code. When setting to a higher value, the new
Julia code is run.

* Replaced parameters in `training` with `Constant` and `Variable`
classes.
  [(#298)](#298)

* Improved how states, transformations, and detectors deal with
parameters by replacing the `Parametrized` class with `ParameterSet`.
  [(#298)](#298)

* Includes julia dependencies into the python packaging for downstream
installation reproducibility.
Removes dependency on tomli to load pyproject.toml for version info,
uses importlib.metadata instead.
  [(#303)](#303)
  [(#304)](#304)

* Improves the algorithms implemented in `vanilla` and `vanilla_vjp` to
achieve a speedup.
Specifically, the improved algorithms work on flattened arrays (which
are reshaped before being returned) as opposed to multi-dimensional
array.
  [(#312)](#312)
  [(#318)](#318)

* Adds functions `hermite_renormalized_batch` and
`hermite_renormalized_diagonal_batch` to speed up calculating
  Hermite polynomials over a batch of B vectors.
  [(#308)](#308)

* Added suite to filter undesired warnings, and used it to filter
tensorflow's ``ComplexWarning``s.
  [(#332)](#332)


### Bug fixes

* Added the missing `shape` input parameters to all methods `U` in the
`gates.py` file.
[(#291)](#291)
* Fixed inconsistent use of `atol` in purity evaluation for Gaussian
states.
[(#294)](#294)
* Fixed the documentations for loss_XYd and amp_XYd functions for
Gaussian channels.
[(#305)](#305)
* Replaced all instances of `np.empty` with `np.zeros` to fix
instabilities.
[(#309)](#309)

---------

Co-authored-by: Sebastián Duque Mesa <[email protected]>
Co-authored-by: JacobHast <[email protected]>
Co-authored-by: elib20 <[email protected]>
Co-authored-by: ziofil <[email protected]>
Co-authored-by: ziofil <[email protected]>
Co-authored-by: Luke Helt <[email protected]>
Co-authored-by: zeyueN <[email protected]>
Co-authored-by: Robbe De Prins <[email protected]>
Co-authored-by: Robbe De Prins (UGent-imec) <[email protected]>
Co-authored-by: Yuan <[email protected]>
Co-authored-by: Ryk <[email protected]>
Co-authored-by: Gabriele Gullì <[email protected]>
Co-authored-by: Yuan Yao <[email protected]>
Co-authored-by: Yuan Yao <[email protected]>
Co-authored-by: heltluke <[email protected]>
Co-authored-by: Tanner Rogalsky <[email protected]>
Co-authored-by: Jan Provazník <[email protected]>
Copy link

codecov bot commented Feb 6, 2024

Codecov Report

Attention: Patch coverage is 95.59786% with 74 lines in your changes are missing coverage. Please review.

Project coverage is 84.14%. Comparing base (95752f3) to head (f4898e0).
Report is 59 commits behind head on develop.

❗ Current head f4898e0 differs from pull request most recent head c4b9dbd. Consider uploading reports for the commit c4b9dbd to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #302      +/-   ##
===========================================
+ Coverage    78.75%   84.14%   +5.39%     
===========================================
  Files           54       65      +11     
  Lines         4514     4775     +261     
===========================================
+ Hits          3555     4018     +463     
+ Misses         959      757     -202     
Files Coverage Δ
mrmustard/__init__.py 100.00% <100.00%> (ø)
mrmustard/_version.py 100.00% <100.00%> (ø)
mrmustard/lab/abstract/__init__.py 100.00% <100.00%> (ø)
mrmustard/lab/abstract/measurement.py 89.41% <100.00%> (+2.99%) ⬆️
mrmustard/lab/circuit.py 93.54% <100.00%> (+0.44%) ⬆️
mrmustard/lab/states.py 100.00% <100.00%> (ø)
mrmustard/lab/utils.py 100.00% <100.00%> (ø)
mrmustard/math/__init__.py 100.00% <100.00%> (+25.00%) ⬆️
mrmustard/math/backend_base.py 100.00% <100.00%> (ø)
mrmustard/math/backend_numpy.py 100.00% <100.00%> (ø)
... and 47 more

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4d47e8e...c4b9dbd. Read the comment docs.

SamFerracin and others added 4 commits February 8, 2024 17:19
Updates the `upload.yml` file so that before running the tests, it sets
Julia up (version `1.9.3`).
This setup now matches closely to that in the other `.yml` files, in
particular to that in `build.yml`

---------

Co-authored-by: Sebastián Duque Mesa <[email protected]>
Co-authored-by: JacobHast <[email protected]>
Co-authored-by: elib20 <[email protected]>
Co-authored-by: ziofil <[email protected]>
Co-authored-by: ziofil <[email protected]>
Co-authored-by: Luke Helt <[email protected]>
Co-authored-by: zeyueN <[email protected]>
Co-authored-by: Robbe De Prins <[email protected]>
Co-authored-by: Robbe De Prins (UGent-imec) <[email protected]>
Co-authored-by: Yuan <[email protected]>
Co-authored-by: Ryk <[email protected]>
Co-authored-by: Gabriele Gullì <[email protected]>
Co-authored-by: Yuan Yao <[email protected]>
Co-authored-by: Yuan Yao <[email protected]>
Co-authored-by: heltluke <[email protected]>
Co-authored-by: Tanner Rogalsky <[email protected]>
Co-authored-by: Jan Provazník <[email protected]>
### New features
* Added functions to generate the ``(A, b, c)`` triples for the
Fock-Bargmann representation of
several states and gates.
[(#338)](#338)

### Breaking changes

### Improvements

### Bug fixes
* Fixing a bug in `_transform_gaussian` in transformation.py that
modifies the input state's cov and means.
[(#349)](#349)
* Fixing a bug in `general_dyne` in physics/gaussian.py that returns the
wrong probability and outcomes with given projection.
[(#349)](#349)

### Documentation

### Tests

### Contributors
@SamFerracin @ziofil @sylviemonet

---------

Co-authored-by: Sebastián Duque Mesa <[email protected]>
Co-authored-by: JacobHast <[email protected]>
Co-authored-by: elib20 <[email protected]>
Co-authored-by: ziofil <[email protected]>
Co-authored-by: ziofil <[email protected]>
Co-authored-by: Luke Helt <[email protected]>
Co-authored-by: zeyueN <[email protected]>
Co-authored-by: Robbe De Prins <[email protected]>
Co-authored-by: Robbe De Prins (UGent-imec) <[email protected]>
Co-authored-by: Yuan <[email protected]>
Co-authored-by: Ryk <[email protected]>
Co-authored-by: Gabriele Gullì <[email protected]>
Co-authored-by: Yuan Yao <[email protected]>
Co-authored-by: Yuan Yao <[email protected]>
Co-authored-by: heltluke <[email protected]>
Co-authored-by: Tanner Rogalsky <[email protected]>
Co-authored-by: Jan Provazník <[email protected]>
**Context:**
Bumping `tensorflow-macos` to v2.15
**Context:**
There is a mismatch of tags, this reconciles
@ziofil ziofil closed this Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants