Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
apchytr committed Oct 8, 2024
1 parent d5f9f3a commit f0a969c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
5 changes: 2 additions & 3 deletions mrmustard/lab_dev/circuit_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,16 +526,15 @@ def to_bargmann(self) -> CircuitComponent:
.. code-block::
>>> from mrmustard.lab_dev import Dgate
>>> from mrmustard.physics.representations import Bargmann
>>> from mrmustard.physics.ansatz import PolyExpAnsatz
>>> d = Dgate([1], x=0.1, y=0.1)
>>> d_fock = d.to_fock(shape=3)
>>> d_bargmann = d_fock.to_bargmann()
>>> assert d_bargmann.name == d.name
>>> assert d_bargmann.wires == d.wires
>>> assert isinstance(d_bargmann.representation, Bargmann)
>>> assert isinstance(d_bargmann.ansatz, PolyExpAnsatz)
"""
if isinstance(self.ansatz, PolyExpAnsatz):
return self
Expand Down
4 changes: 2 additions & 2 deletions mrmustard/lab_dev/states/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def from_bargmann(
.. code-block::
>>> from mrmustard.physics.representations import Bargmann
>>> from mrmustard.physics.ansatz import PolyExpAnsatz
>>> from mrmustard.physics.triples import coherent_state_Abc
>>> from mrmustard.lab_dev.states.base import Ket
Expand All @@ -193,7 +193,7 @@ def from_bargmann(
>>> coh = Ket.from_bargmann(modes, triple)
>>> assert coh.modes == modes
>>> assert coh.representation == Bargmann(*triple)
>>> assert coh.ansatz == PolyExpAnsatz(*triple)
>>> assert isinstance(coh, Ket)
Args:
Expand Down
6 changes: 3 additions & 3 deletions mrmustard/physics/ansatz/polyexp_ansatz.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ class PolyExpAnsatz(Ansatz):
.. code-block ::
>>> from mrmustard.physics.representations import Bargmann
>>> from mrmustard.physics.representations import PolyExpAnsatz
>>> from mrmustard.physics.triples import displacement_gate_Abc, vacuum_state_Abc
>>> # bargmann representation of one-mode vacuum
>>> rep_vac = Bargmann(*vacuum_state_Abc(1))
>>> rep_vac = PolyExpAnsatz(*vacuum_state_Abc(1))
>>> # bargmann representation of one-mode dgate with gamma=1+0j
>>> rep_dgate = Bargmann(*displacement_gate_Abc(1))
>>> rep_dgate = PolyExpAnsatz(*displacement_gate_Abc(1))
The inner product is defined as the contraction of two Bargmann objects across marked indices.
Indices are marked using ``__getitem__``. Once the indices are marked for contraction, they are
Expand Down

0 comments on commit f0a969c

Please sign in to comment.