Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tutorials for lab_dev and physics #392

Open
wants to merge 92 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
5937525
added func
SamFerracin Apr 15, 2024
be61862
done
SamFerracin Apr 16, 2024
046af14
done
SamFerracin Apr 16, 2024
ee13a6c
test trace out
SamFerracin Apr 16, 2024
1ff349c
tests
SamFerracin Apr 16, 2024
7934dae
more progress
SamFerracin Apr 17, 2024
4316359
tests
SamFerracin Apr 17, 2024
7fdfd39
done
SamFerracin Apr 17, 2024
56e4467
done
SamFerracin Apr 17, 2024
59019a0
ugh
SamFerracin Apr 17, 2024
375d260
Merge branch 'develop' of https://github.com/XanaduAI/MrMustard into …
SamFerracin Apr 17, 2024
91a9678
done
SamFerracin Apr 17, 2024
55df8d1
Merge branch 'develop' of https://github.com/XanaduAI/MrMustard into …
SamFerracin Apr 19, 2024
decc3d0
need to fix things
SamFerracin Apr 19, 2024
7b642a1
Merge branch 'develop' into exp-val
ziofil Apr 19, 2024
d133ecc
Update mrmustard/lab_dev/states/base.py
Apr 22, 2024
f479998
Update mrmustard/lab_dev/states/base.py
Apr 22, 2024
90161ef
some progress
SamFerracin Apr 22, 2024
6e7de41
etsts pass
SamFerracin Apr 22, 2024
a3ab903
done?
SamFerracin Apr 22, 2024
8e80056
Update mrmustard/lab_dev/states/base.py
Apr 22, 2024
6198a17
Update mrmustard/lab_dev/states/base.py
Apr 22, 2024
397d251
bl
SamFerracin Apr 22, 2024
665bc82
odc
SamFerracin Apr 22, 2024
076f2f0
done
SamFerracin Apr 25, 2024
2a4b1c7
ll
SamFerracin Apr 25, 2024
0eeb99f
bug
SamFerracin Apr 25, 2024
cc38e05
Update mrmustard/lab_dev/states/base.py
Apr 25, 2024
36b66eb
Update mrmustard/lab_dev/states/base.py
Apr 25, 2024
d25e6bb
Update mrmustard/lab_dev/states/base.py
Apr 25, 2024
66a90de
Update mrmustard/lab_dev/states/base.py
Apr 25, 2024
9513299
Merge branch 'exp-val' of https://github.com/XanaduAI/MrMustard into …
SamFerracin Apr 25, 2024
b073f0a
Merge branch 'develop' of https://github.com/XanaduAI/MrMustard into …
SamFerracin Apr 25, 2024
d31eaa8
ds
SamFerracin Apr 25, 2024
562295e
revert
SamFerracin Apr 25, 2024
a78ea14
cr
SamFerracin Apr 26, 2024
010b732
gaussian integrals
SamFerracin Apr 26, 2024
7dc4088
more
SamFerracin Apr 26, 2024
f6b1cf5
Merge branch 'exp-val' of https://github.com/XanaduAI/MrMustard into …
SamFerracin Apr 26, 2024
c673986
..
SamFerracin Apr 29, 2024
a5fe7a3
..
SamFerracin Apr 29, 2024
09aa175
..
SamFerracin Apr 29, 2024
013abdb
..
SamFerracin Apr 29, 2024
e45ccd8
..
SamFerracin Apr 29, 2024
bc01a51
progress
SamFerracin Apr 29, 2024
e52d85f
yuan
SamFerracin May 3, 2024
9122fc0
progress
SamFerracin May 3, 2024
f8a6357
add docs for init physics
sylviemonet May 3, 2024
9815b93
add more docs
sylviemonet May 3, 2024
02a9249
add docs
sylviemonet May 3, 2024
3b2c366
add anstaz docs
sylviemonet May 3, 2024
fc95c68
Merge branch 'develop' into tutorials
sylviemonet May 3, 2024
f254561
bargmann theory docs
sylviemonet May 3, 2024
e5bd587
test acs|| diagram
sylviemonet May 6, 2024
110f959
converters doc
sylviemonet May 6, 2024
b6e6c08
moved phys funcs
sylviemonet May 7, 2024
a220c98
oops
sylviemonet May 7, 2024
e3b8822
add diagram and fix codefactor
sylviemonet May 7, 2024
0ab8fd3
fix code block converters
sylviemonet May 7, 2024
a25f9db
s
SamFerracin May 7, 2024
5d2e3d3
docs in converters
sylviemonet May 7, 2024
c020208
fix the structure
sylviemonet May 7, 2024
a7cb003
fix the structure again
sylviemonet May 7, 2024
6660ea4
big changes in structure in physics
sylviemonet May 7, 2024
fd4cdda
try again
sylviemonet May 7, 2024
387c0c3
try to fix errors with math
sylviemonet May 7, 2024
190a526
states
SamFerracin May 7, 2024
9d79fb7
Merge branch 'tutorials' of https://github.com/XanaduAI/MrMustard int…
SamFerracin May 7, 2024
5626f27
bargmann docs
sylviemonet May 7, 2024
e8fbe74
bargmamnn docs
sylviemonet May 7, 2024
a0be9ab
fix bugs in cc
sylviemonet May 7, 2024
d6b3dd7
julia
SamFerracin May 7, 2024
51238fa
Merge branch 'tutorials' of https://github.com/XanaduAI/MrMustard int…
SamFerracin May 7, 2024
e46d9a9
the docs in bargmann
sylviemonet May 7, 2024
0acd882
fix diagrams
sylviemonet May 7, 2024
39089af
bargmann docs goooo
sylviemonet May 7, 2024
17f9b31
fix diagrams
sylviemonet May 7, 2024
9c339a2
add docs in fock
sylviemonet May 7, 2024
1fbc022
add the docs for ansatze
sylviemonet May 8, 2024
5d54544
gaussian integral docs
sylviemonet May 8, 2024
42f5273
progress
SamFerracin May 9, 2024
d7a5a67
fix bugs in docs
sylviemonet May 9, 2024
d887eaa
add comments
sylviemonet May 9, 2024
7122176
Merge branch 'tutorials' of https://github.com/XanaduAI/MrMustard int…
SamFerracin May 9, 2024
c9e9189
oops
SamFerracin May 10, 2024
2586020
Merge branch 'develop' into tutorials
sylviemonet May 13, 2024
0c02cee
Merge branch 'develop' into tutorials
sylviemonet May 15, 2024
ea7333e
Update mrmustard/lab_dev/circuit_components.py
sylviemonet May 15, 2024
f4889f8
fix bugs from kasper's comments
sylviemonet May 15, 2024
fea110a
fix codefactor
sylviemonet May 15, 2024
da55f30
blacked
sylviemonet May 15, 2024
248bc1b
Merge branch 'develop' into tutorials
sylviemonet May 15, 2024
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
2 changes: 1 addition & 1 deletion mrmustard/lab_dev/circuit_components.py
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another general comment, some of this can be confusing if one has no idea of the concept of wires (potential 4 wires, in/out + bra/ket). Before a talk from Fillipo last week I had never heard about this idea before. Maybe it would be nice with a general intro or maybe a link to the wires channel that introduces this important concept that is used throughout (unless it is obvious to anyone in the CV community).

Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
>>> alpha_minus = Coherent(modes=[0], x=-1)

>>> # initialize a superposition of the two states
>>> alpha_plus*(1/3)**0.5 + alpha_minus*(2/3)**0.5
>>> state = alpha_plus*(1/3)**0.5 + alpha_minus*(2/3)**0.5

"""

Expand Down
43 changes: 38 additions & 5 deletions mrmustard/physics/bargmann.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,46 @@
.. math::
|z\rangle_b = e^\frac{|z|^2}{2}|z\rangle_c = \sum_n \frac{z^n}{\sqrt{n!}}|n\rangle_f.

Any Gaussian objects :math:`O` can be written in the Bargmann basis as a Gaussian exponential function, parametrized by a matrix :math:`A`, a vector :math:`b` and a scalar :math:`c`, which is called ``triples`` through all the documentations in MM.
The objects in Bargmann representation uses the :class:`~mrmustard.physics.ansatze.PolyExpAnsatz` and the information is stored in the triple (A,b,c).

A ``n``-mode pure Gaussian state :math:`|\psi\rangle` can be defined as
Any Gaussian objects :math:`O` can be written in the Bargmann basis as a Gaussian exponential function, parametrized by a matrix :math:`A`, a vector :math:`b` and a scalar :math:`c`, which is called ``triples`` through all the documentations in MM:

.. math::
\langle \alpha | \psi \rangle =
<\vec{\alpha}|O\rangle = c \exp\left( \frac12 \vec{\alpha}^T A \vec{\alpha} + \vec{\alpha}^T b \right),

Note that:

*The objects in Bargmann representation uses the :class:`~mrmustard.physics.ansatze.PolyExpAnsatz` and the information is stored in the triple (A,b,c).
*The expression :math:`<\vec{\alpha}|O\rangle` is vectorized the variables vector :math:`\vec{\alpha}`, which is different for different quantum objects.
As for a ``n``-mode pure Gaussian state :math:`\langle\vec{\alpha}|\psi\rangle`, the variable vector denotes :math:`\vec{\alpha} = (\alpha^*_0, \alpha^*_1, ..., \alpha^*_n)`.
.. code-block::

╔═══════╗
║ ║─────▶ :math:`\alpha^*_0`
║ |psi> ║─────▶ :math:`\alpha^*_1`
║ ║...
║ ║─────▶ :math:`\alpha^*_n`
╚═══════╝
All the wires in the diagram below correspond to the `out_ket` wires in :class:`~mrmustard.lab_dev.wires.Wires`.

As for a ``n``-mode mixed Gaussian state :math:`\langle\vec{\alpha}|\rho|\vec{\beta}\rangle`, the variable vector denotes :math:`\vec{\alpha} = (\alpha^*_0, \alpha^*_1, ..., \alpha^*_n, \beta_0, \beta_1,..., \beta_n)`.
.. code-block::

╔═══════╗
║ ║─────▶ :math:`\alpha^*_0`
║ ║─────▶ :math:`\alpha^*_1`
║ ║─────▶ ...
║ ║─────▶ :math:`\alpha^*_n`
║ rho ║─────▶ :math:`\beta_0_1`
║ ║─────▶ :math:`\beta_1`
║ ║─────▶ ...
║ ║─────▶ :math:`\beta_n`
╚═══════╝
The wires in the diagram below correspond to the `out_ket` wires (:math:`\beta`) and the `out_bra` wires ((:math:`\alpha^*`) in :class:`~mrmustard.lab_dev.wires.Wires`.

As for a ``n``-mode Gaussian unitary :math:`\langle\vec{\alpha}|U|\vec{\beta}\rangle`, the variable vector denotes :math:`\vec{\alpha} = (\alpha^*_0, \alpha^*_1, ..., \alpha^*_n)`.

As for a ``n``-mode Gaussian Channel :math:`\langle \vec{\alpha}|\Psi(|\vec{\gamma}\rangle\langle\vec{\delta}|)|\vec{\beta}`, the variable vector denotes :math:`\vec{\alpha} = (\alpha^*_0, \alpha^*_1, ..., \alpha^*_n, \beta_0, \beta_1,..., \beta_n, \delta^*_0, \delta^*_1, ..., \delta^*_n, \gamma_0, \gamma_1,..., \gamma_n)`.


"""
import numpy as np

Expand Down
Loading