18 Computational implementation
On this page · Permalink · Source line 1792
The accompanying Python package implements the formulas and finite models used in the paper.
projector_transfer_semigroups
The computational organization mirrors the paper:
18.1 Representative algorithms
On this page · Permalink · Source line 1812
def bayes_update(prior, likelihood):
p = normalize(prior)
evidence = likelihood @ p
if evidence <= 0:
raise ValueError("positive evidence required")
return likelihood * p / evidencedef block_composition(left, right):
result = []
for beta in range(len(left)):
row = []
for alpha in range(len(left)):
value = sum(
left[beta][gamma] @ right[gamma][alpha]
for gamma in range(len(left))
)
row.append(value)
result.append(row)
return resultdef feshbach_effective_operator(A, retained, z):
App, Apq, Aqp, Aqq = split_blocks(A, retained)
return z*I - App - Apq @ inv(z*I - Aqq) @ AqpThe full implementation, tests, tables, figure-generation code, and exact numerical record are included with the release rather than embedded in the typeset paper.