Skip to content

Commit

Permalink
Bumping tensorflow-macos to v2.15 (#375)
Browse files Browse the repository at this point in the history
**Context:**
Bumping `tensorflow-macos` to v2.15
  • Loading branch information
SamFerracin authored Mar 28, 2024
1 parent 5a823a4 commit e9261b6
Show file tree
Hide file tree
Showing 6 changed files with 447 additions and 397 deletions.
29 changes: 28 additions & 1 deletion .github/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,31 @@
# Release 0.7.1 (current release)
# Release 0.7.2 (current release)

### New features
* Added a function ``to_fock`` to map different representations into Fock representation.
[(#355)](https://github.com/XanaduAI/MrMustard/pull/355)

* Added a new Abc triple for s-parametrized displacement gate.
[(#368)](https://github.com/XanaduAI/MrMustard/pull/368)

### Breaking changes

### Improvements

### Bug fixes

### Documentation

### Tests

### Contributors
[Samuele Ferracin](https://github.com/SamFerracin),
[Yuan Yao](https://github.com/sylviemonet)
[Filippo Miatto](https://github.com/ziofil)


---

# Release 0.7.1

### New features
* Added functions to generate the ``(A, b, c)`` triples for the Fock-Bargmann representation of
Expand Down
37 changes: 36 additions & 1 deletion mrmustard/math/lattice/strategies/compactFock/inputValidation.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,42 @@
from mrmustard.math.lattice.strategies.compactFock.singleLeftoverMode_grad import (
fock_representation_1leftoverMode_grad,
)
from thewalrus._hafnian import input_validation


def input_validation(A, rtol=1e-05, atol=1e-08):
"""Checks that the matrix A satisfies the requirements for Hafnian calculation.
These include:
* That the ``A`` is a NumPy array
* That ``A`` is square
* That ``A`` does not contain any NaNs
* That ``A`` is symmetric
.. note:: This function is an adaptation of the of an analogous method in The Walrus.
Args:
A (array): a NumPy array.
rtol (float): the relative tolerance parameter used in ``np.allclose``
atol (float): the absolute tolerance parameter used in ``np.allclose``
Returns:
bool: returns ``True`` if the matrix satisfies all requirements
"""

if not isinstance(A, np.ndarray):
raise TypeError("Input matrix must be a NumPy array.")

n = A.shape

if n[0] != n[1]:
raise ValueError("Input matrix must be square.")

if np.isnan(A).any():
raise ValueError("Input matrix must not contain NaNs.")

if not np.allclose(A, A.T, rtol=rtol, atol=atol):
raise ValueError("Input matrix must be symmetric.")

return True


def hermite_multidimensional_diagonal(A, B, G0, cutoffs, rtol=1e-05, atol=1e-08):
Expand Down
7 changes: 0 additions & 7 deletions mrmustard/physics/gaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

from typing import Any, Optional, Sequence, Tuple, Union

from thewalrus.quantum import is_pure_cov

from mrmustard import math, settings
from mrmustard.math.tensor_wrappers.xptensor import XPMatrix, XPVector
from mrmustard.utils.typing import Matrix, Scalar, Vector
Expand Down Expand Up @@ -660,11 +658,6 @@ def number_cov(cov: Matrix, means: Vector) -> Matrix:
)


def is_mixed_cov(cov: Matrix) -> bool: # TODO: deprecate
r"""Returns ``True`` if the covariance matrix is mixed, ``False`` otherwise."""
return not is_pure_cov(math.asnumpy(cov))


def trace(cov: Matrix, means: Vector, Bmodes: Sequence[int]) -> Tuple[Matrix, Vector]:
r"""Returns the covariances and means after discarding the specified modes.
Expand Down
Loading

0 comments on commit e9261b6

Please sign in to comment.