Recently, I have been creating a "brick layer" circuit of random unitary gates (each acting on 2 qubits) which acts on a n qubit register using cirq. A typical circuit looks like this.
(Where a top and bottom label symbolises one gate).
The code used to reproduce it is here. https://colab.research.google.com/drive/1Rs3knKOJV8CddSQLzl1HgO1L-GR7sfbK?usp=sharing
I wish to extrapolate my model to n qudits as opposed to qubits. I have been successful in applying this to qutrits. The code for this is below.
https://colab.research.google.com/drive/13xz7PP7WZ676-PSpg06U_QmRdg4kRXDr?usp=sharing
However, when I try to do this for some general qudit register. I always land up with a type error.
See the code below (which is very similar to the others)
https://colab.research.google.com/drive/1Ij0ZdNixv5krCIBa5-esKq92KpGzBo9Z?usp=sharing
Does anybody know how to fix this error? Help would be greatly appreciated :) I reckoned as it was easy to get the code working for qutrits it shouldn't be so hard to get it working for any general qudit register.
Cheers, Luke