-
Notifications
You must be signed in to change notification settings - Fork 56
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
the Bristolian #316
the Bristolian #316
Conversation
Codecov Report
@@ Coverage Diff @@
## master #316 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 22 22
Lines 1575 1603 +28
=========================================
+ Hits 1575 1603 +28
Continue to review full report at Codecov.
|
Almost there @jakeffbulmer : you just need a test for the branching here: You can likely parametrize one of the test you wrote... |
@@ -118,7 +118,7 @@ | |||
interferometer, | |||
grad_hermite_multidimensional, | |||
) | |||
from ._permanent import perm, permanent_repeated | |||
from ._permanent import perm, permanent_repeated, brs, ubrs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jakeffbulmer : you probably want to add brs
and ubrs
into the __all__
list in line 132
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and also into the autosummary in line 78. This is so that they are included when the documentation is generated.
thewalrus/_permanent.py
Outdated
Returns: | ||
float: probability of Fock state, n, scattering to m, through an interferometer, U | ||
""" | ||
assert sum(n) == sum(m) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since this is not a jitted function, it would be better if you RaiseValueError
instead of using assert. You will need to also add a test checking that the exception is raised correctly.
thewalrus/_permanent.py
Outdated
assert len(n) == T.shape[1] | ||
assert len(d) == T.shape[0] | ||
assert T.shape[0] <= T.shape[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above. RaiseValueError
is preferred.
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests are really great. Fantastic work @jakeffbulmer !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments about inclusion of functions into init and autosummary and not using assert
s inside non-jitted functions.
thewalrus/_permanent.py
Outdated
from numba import jit, prange | ||
|
||
from scipy.special import factorial | ||
from scipy.linalg import sqrtm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Nicolas Quesada <991946+nquesada@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great!
Thanks @sduquemesa |
Context:
matrix functions for calculating threshold detector statistics of Fock states interfering in linear optical interferometers.
Description of the Change:
New functions, the "Bristolian"
brs
and the "Unitary Bristolian"ubrs
are added to_permanent.py
and imported in__init__.py
.Benefits:
Allows for calculation of threshold detector statistics in experiments where Fock states are interfered in linear optical interferometers.
There are also new functions in _permanent.py called
fock_threshold_prob
andfock_prob
which make it easy to get the probabilities of Fock state interference in linear optics. These latter functions are not imported in the init file, but maybe they could be useful elsewhere?Possible Drawbacks:
What could possibly go wrong?
Related GitHub Issues: