pdft.circuit.build_circuit_einsum#
- pdft.circuit.build_circuit_einsum(gates, m, n, *, inverse)[source]#
Convert a gate sequence to (subscripts, tensors, shapes).
gatesis applied in order to a circuit onm + nqubits (1-indexed). For CP gates, the 2x2 tensor shares the current wire labels of its control and target qubits and does NOT introduce new labels (the gate is diagonal).Returns the triple needed by
einsum_cache.optimize_code_cached. The returned tensor list and tensor-shape list are sorted so Hadamards come first (matching Julia’sperm_vec).