Python Forum
Triplet Combinations of All Values
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Triplet Combinations of All Values
#2
Probably you could use itertools.product to generate them.

>>> from itertools import product
>>> list(product("ab", repeat=3))
[('a', 'a', 'a'), ('a', 'a', 'b'), ('a', 'b', 'a'), ('a', 'b', 'b'), ('b', 'a', 'a'), ('b', 'a', 'b'), ('b', 'b', 'a'), ('b', 'b', 'b')]
So something similar to:
for triplet in product((a, b), repeat=3):
    cirq.kron(cirq.unitary(cirq.rz(triplet[0])),cirq.unitary(cirq.rz(triplet[1])),cirq.unitary(cirq.rz(triplet[2])))
Reply


Messages In This Thread
Triplet Combinations of All Values - by quest - Nov-04-2020, 11:17 PM
RE: Triplet Combinations of All Values - by bowlofred - Nov-04-2020, 11:38 PM
RE: Triplet Combinations of All Values - by quest - Nov-05-2020, 09:22 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Finding combinations of list of items (30 or so) LynnS 1 907 Jan-25-2023, 02:57 PM
Last Post: deanhystad
  How can I find all combinations with a regular expression? AlekseyPython 0 1,700 Jun-23-2021, 04:48 PM
Last Post: AlekseyPython
  All possible combinations CODEP 2 1,898 Dec-01-2020, 06:10 PM
Last Post: deanhystad
  Converting string to hex triplet menator01 4 4,408 Aug-03-2020, 01:00 PM
Last Post: deanhystad
  All possible combinations of multiplications Shreya10o 0 1,695 May-23-2020, 07:45 AM
Last Post: Shreya10o
  Do something with all possible combinations of a list 3Pinter 7 4,171 Sep-11-2019, 08:19 AM
Last Post: perfringo
  list of string combinations Skaperen 8 3,423 May-22-2019, 01:18 PM
Last Post: Skaperen
  Python to iterate a number of possible combinations teflon 4 4,001 Apr-24-2019, 03:00 AM
Last Post: scidam
  Distances between all combinations in datatset amyd 6 3,944 Dec-13-2018, 01:23 PM
Last Post: amyd
  Combinations of list of lists dannyH 2 3,380 May-14-2018, 09:54 PM
Last Post: dannyH

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020