random_tiling#
- class discopy.quantum.circuit.random_tiling(n_qubits, depth=3, gateset=None, seed=None)[source]#
Bases:
Returns a random Euler decomposition if n_qubits == 1, otherwise returns a random tiling with the given depth and gateset.
>>> from discopy.quantum.gates import CX, H, T, Rx, Rz >>> c = random_tiling(1, seed=420) >>> print(c) Rx(0.0263) >> Rz(0.781) >> Rx(0.273) >>> print(random_tiling(2, 2, gateset=[CX, H, T], seed=420)) CX >> T @ Id(1) >> Id(1) @ T >>> print(random_tiling(3, 2, gateset=[CX, H, T], seed=420)) CX @ Id(1) >> Id(2) @ T >> H @ Id(2) >> Id(1) @ H @ Id(1) >> Id(2) @ H >>> print(random_tiling(2, 1, gateset=[Rz, Rx], seed=420)) Rz(0.673) @ Id(1) >> Id(1) @ Rx(0.273)