Library / Noise Channel / Noise Channel examples
Noise Channel examples
Depolarizing the braid, amplitude damping on one wire, and a rejected probability list.
- Example 1 — depolarize wire 0 of the braid
- Example 2 — amplitude damping from |1⟩
- Example 3 — probabilities that do not sum to 1
Example 1 — depolarize wire 0 of the braid
Lattice script
pure = aether_braid()
mixed = Noise.as_density(pure)
mixed.apply("depolarize", on=0, p=0.1)
record = mixed.expect(["Z0*Z1", "Z1*Z2", "X0*X1*X2"])
# 0.9, 1, 0.9
assert record.source == "noise-channel"
assert "depolarize" in record.map⟨Z1 Z2⟩ is the control: that pair does not touch wire 0, so the local map must leave it at 1. If it moves, the map was not local.
Example 2 — amplitude damping from |1⟩
Lattice script
register = Lattice.open(width=1, endian="little", ceiling="1 MiB")
register.apply("X", on=0) # |1⟩
mixed = Noise.as_density(register)
mixed.apply("amp-damp", on=0, gamma=0.25)
# population of |0⟩ becomes 0.25; population of |1⟩ becomes 0.75
pop = mixed.expect(["Z0"])
# ⟨Z⟩ = p0 - p1 = 0.25 - 0.75 = -0.5Example 3 — probabilities that do not sum to 1
Lattice script
mixed.apply("pauli-mix", on=0, probs={"X": 0.2, "Z": 0.2})
# Parameter fault: the masses sum to 0.4, and identity was not given the restThe caller names the identity’s mass explicitly when they want a residual. The product will not invent it.