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

Implement experimental general get_params_to_statevector #121

Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ Below are some use-case notebooks. These both illustrate the flexibility of quja
- [classification.ipynb](https://github.com/CQCL/qujax/blob/develop/examples/classification.ipynb) - train a quantum circuit for binary classification using data re-uploading.
- [generative_modelling.ipynb](https://github.com/CQCL/qujax/blob/develop/examples/generative_modelling.ipynb) - uses a parameterised quantum circuit as a generative model for a real life dataset. Trains via stochastic gradient Langevin dynamics on the maximum mean discrepancy between statetensor and dataset.

Experimental (i.e. uses an unstable API which might change in future versions):

- [noise_channel_monte_carlo.ipynb](https://github.com/CQCL/qujax/blob/develop/examples/experimental/noise_channel_monte_carlo.ipynb) - statevector simulation of circuit noise using the Monte-Carlo/quantum trajectories approach.

The [pytket](https://github.com/CQCL/pytket) repository also contains `tk_to_qujax` implementations for some of the above at [pytket-qujax_classification.ipynb](https://github.com/CQCL/pytket/blob/main/examples/pytket-qujax-classification.ipynb),
[pytket-qujax_heisenberg_vqe.ipynb](https://github.com/CQCL/pytket/blob/main/examples/pytket-qujax_heisenberg_vqe.ipynb)
and [pytket-qujax_qaoa.ipynb](https://github.com/CQCL/pytket/blob/main/examples/pytket-qujax_qaoa.ipynb).
8 changes: 8 additions & 0 deletions docs/experimental.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Experimental
=======================

.. toctree::
:titlesonly:

Pure state simulation <experimental/statetensor>

13 changes: 13 additions & 0 deletions docs/experimental/statetensor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Pure state simulation
=======================

.. toctree::
:titlesonly:

statetensor/get_default_gates
statetensor/get_default_operations
statetensor/get_params_to_statetensor_func
statetensor/get_params
statetensor/parse_op
statetensor/wrap_parameterised_tensor

4 changes: 4 additions & 0 deletions docs/experimental/statetensor/get_default_gates.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
get_default_gates
==============================================

.. autofunction:: qujax.experimental.statetensor.get_default_gates
4 changes: 4 additions & 0 deletions docs/experimental/statetensor/get_default_operations.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
get_default_operations
==============================================

.. autofunction:: qujax.experimental.statetensor.get_default_operations
4 changes: 4 additions & 0 deletions docs/experimental/statetensor/get_params.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
get_params
==============================================

.. autofunction:: qujax.experimental.statetensor.get_params
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
get_params_to_statetensor_func
=====================================

.. autofunction:: qujax.experimental.statetensor.get_params_to_statetensor_func
4 changes: 4 additions & 0 deletions docs/experimental/statetensor/parse_op.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
parse_op
==============================================

.. autofunction:: qujax.experimental.statetensor.parse_op
4 changes: 4 additions & 0 deletions docs/experimental/statetensor/wrap_parameterised_tensor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
wrap_parameterised_tensor
==============================================

.. autofunction:: qujax.experimental.statetensor.wrap_parameterised_tensor
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Contents
Pure state simulation <statetensor>
Mixed state simulation <densitytensor>
Utility functions <utils>
Experimental <experimental>

.. toctree::
:caption: Links:
Expand Down
2 changes: 1 addition & 1 deletion docs/statetensor/apply_gate.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apply_gate
==============================================

.. autofunction:: qujax.apply_gate
.. autofunction:: qujax.experimental.statetensor.apply_gate
628 changes: 628 additions & 0 deletions examples/experimental/noise_channel_monte_carlo.ipynb

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions qujax/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@

import qujax.typing

import qujax.experimental
import qujax.experimental.statetensor

# pylint: disable=undefined-variable
del version
del statetensor
Expand Down
4 changes: 2 additions & 2 deletions qujax/densitytensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from qujax.typing import (
MixedCircuitFunction,
KrausOp,
GateFunction,
ParameterizedGateFunction,
GateParameterIndices,
)

Expand Down Expand Up @@ -86,7 +86,7 @@ def kraus(
def _to_kraus_operator_seq_funcs(
kraus_op: KrausOp,
param_inds: Optional[Union[GateParameterIndices, Sequence[GateParameterIndices]]],
) -> Tuple[Sequence[GateFunction], Sequence[jax.Array]]:
) -> Tuple[Sequence[ParameterizedGateFunction], Sequence[jax.Array]]:
"""
Ensures Kraus operators are a sequence of functions that map (possibly empty) parameters to
tensors and that each element of param_inds_seq is a sequence of arrays that correspond to the
Expand Down
Empty file added qujax/experimental/__init__.py
Empty file.
Loading