tn_noise_learning.circuits#
Ideal circuit as a tensor network that conjugates input states, ρ → U ρ U†.
Each two-qubit gate is split by an operator-Schmidt decomposition into two site tensors joined by a bond, so the
construction works on any qubit connectivity without compression. Raw states enter on legs p{j} (ket) and
q{j} (bra) and leave on the LPDO input legs k{j} and b{j}.
apply_circuit #
apply_circuit(
states_tn: TensorNetwork, circuit: QuantumCircuit
) -> qtn.TensorNetwork
Evolve a raw state network (legs p, q) to U ρ U† with legs k, b, one tensor per site.
Source code in src/tn_noise_learning/circuits.py
123 124 125 126 127 128 | |
circuit_network #
circuit_network(
circuit: QuantumCircuit,
) -> qtn.TensorNetwork
One tensor per site mapping (p_j, q_j) to (k_j, b_j) such that the whole network is U · U†.
Only one- and two-qubit unitary gates are supported; barriers are skipped.
Source code in src/tn_noise_learning/circuits.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
product_state_network #
product_state_network(
states: ndarray | Array, *, raw: bool = True
) -> qtn.TensorNetwork
Batched product states states[j, exp] of shape (num_sites, batch, 2, 2) as site tensors.
Each tensor has legs (exp, ket_j, bra_j): p{j}, q{j} with raw=True (to be evolved by a circuit),
otherwise k{j}, b{j}.
Source code in src/tn_noise_learning/circuits.py
111 112 113 114 115 116 117 118 119 120 | |
raw_ind #
raw_ind(site: int, *, dagger: bool = False) -> str
Leg of a raw (not yet evolved) state: ket side p{j} or bra side q{j}.
Source code in src/tn_noise_learning/circuits.py
44 45 46 | |