Skip to content

Commit

Permalink
Adds doscstring
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Quesada committed Sep 12, 2023
1 parent b40d9c1 commit c8273b6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
15 changes: 0 additions & 15 deletions thewalrus/internal_modes/fock_density_matrices.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from ..symplectic import passive_transformation
from .._hafnian import nb_binom, nb_ix, find_kept_edges, f_from_matrix
from .utils import (
nb_block,
nb_Qmat,
spatial_reps_to_schmidt_reps,
fact,
Expand Down Expand Up @@ -55,20 +54,6 @@ def _density_matrix_single_mode(cov, pattern, normalize=False, LO_overlap=None,

cov = project_onto_local_oscillator(cov, M, LO_overlap=LO_overlap, hbar=hbar)

# create passive transformation of filter
"""
T = np.zeros((M * K, M * K), dtype=np.complex128)
if LO_overlap is not None:
T[0][:K] = LO_overlap
else:
T[0, 0] = 1
T[K:, K:] = np.eye((M - 1) * K, dtype=np.complex128)
# apply channel of filter
P = nb_block(((T.real, -T.imag), (T.imag, T.real)))
L = (hbar / 2) * (np.eye(P.shape[0]) - P @ P.T)
cov = P @ cov @ P.T + L
"""
Q = nb_Qmat(cov, hbar=hbar)
O = np.eye(2 * M * K) - np.linalg.inv(Q)
A = np.empty_like(O, dtype=np.complex128)
Expand Down
13 changes: 13 additions & 0 deletions thewalrus/internal_modes/pnr_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,19 @@ def pnr_prob(covs, i, hbar=2):

@numba.jit(nopython=True, cache=True)
def finite_difference_operator_coeffs(der_order, m, u=None, v=None):
""" Returns the mth coefficient of the finite difference operator of given derivative order.
For details see: E. T. Bax, Finite-difference algorithms for counting problems. PhD thesis, Caltech, 1998.
Args:
der_order (int): derivative order.
m (int): index of the coefficient.
u (int): u value from Bax.
v (int): v value from Bax.
Returns:
tuple: prefactor and value when applied to the finite difference.
"""
if u is None:
u = 2 - der_order
if v is None:
Expand Down

0 comments on commit c8273b6

Please sign in to comment.