Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions perceval/components/unitary_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,16 @@ def describe(self):
params.append("use_polarization=True")
return f"Unitary({', '.join(params)})"

@staticmethod
def random(m: int) -> "Unitary": # Python 3.11 : Replace using Self typing
r"""Static method generating a random unitary component.

:param m: Number of modes in random unitary.
:return: a Unitary circuit component
"""
matrix = Matrix.random_unitary(m)
return Unitary(matrix)


class PERM(Unitary):
"""Permutation
Expand Down