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
Rescale fock_tensor #107
Rescale fock_tensor #107
Conversation
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.
💯 Approved in person (@nquesada, I left two small corrections)
thewalrus/quantum.py
Outdated
@@ -501,6 +501,9 @@ def state_vector(mu, cov, post_select=None, normalize=False, cutoff=5, hbar=2, c | |||
relation :math:`[\x,\p]=i\hbar`. | |||
check_purity (bool): if ``True``, the purity of the Gaussian state is checked | |||
before calculating the state vector. | |||
choi_r (float or None): Value of the two-mode squeezing parameter used in Choi-Jamiolkoski | |||
trick in `fock_tensor`. This variable is only used when `state_vector` is called |
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.
trick in `fock_tensor`. This variable is only used when `state_vector` is called | |
trick in :func:`~.fock_tensor`. This keyword argument should only be used when ``state_vector`` is called |
thewalrus/quantum.py
Outdated
@@ -501,6 +501,9 @@ def state_vector(mu, cov, post_select=None, normalize=False, cutoff=5, hbar=2, c | |||
relation :math:`[\x,\p]=i\hbar`. | |||
check_purity (bool): if ``True``, the purity of the Gaussian state is checked | |||
before calculating the state vector. | |||
choi_r (float or None): Value of the two-mode squeezing parameter used in Choi-Jamiolkoski | |||
trick in `fock_tensor`. This variable is only used when `state_vector` is called | |||
by `fock_tensor`. |
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.
by `fock_tensor`. | |
by :func:`~.fock_tensor`. |
Codecov Report
@@ Coverage Diff @@
## master #107 +/- ##
==========================================
+ Coverage 97.73% 97.74% +<.01%
==========================================
Files 12 12
Lines 884 885 +1
==========================================
+ Hits 864 865 +1
Misses 20 20
Continue to review full report at Codecov.
|
Improves the numerical stability of the
fock_tensor
function by rescaling the matrix whose batch hafnians are needed. That way one does not need to rescale the value of the matrix elements after they have been calculated. This is done by passing an extra argument tostate_vector
.