code: def _to_linear(M, N, L, q):
      "Converts a qubit in chimera coordinates to its linear index."
      (x, y, u, k) = q
      return 2 * L * N * x + 2 * L * y + L * u + f _to_linear(M, N, L, q):
      "Converts a qubit in chimera coordinates to its linear index."
      (x, y, u, k) = q
      return 2 * L * N * x + 2 * L * y + L * u + k
docs: Converts a qubit in chimera coordinates to its linear index.