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

Release/1.26.0 #87

Closed
wants to merge 12 commits into from
Prev Previous commit
Next Next commit
Basic TTN simulation (#41)
* Created new general.py file for logger and cutensornet handle. Updated copyright comment.
* Moved MPS code to make room for TTN.

* Moved ConfigMPS to Config in general.py

* Began implementation of TTN

* Added single-qubit gate support and some basic tests.

* Added vdot to TTN

* Implemented get_amplitude and get_statevector. Current tests passing.

* Implemented canonicalisation

* Canonicalisation debugged

* Exact apply 2q gate implemented and debugged

* Added truncation by chi and value_of_zero

* Unified TTN and MPS via StructuredState abstract class

* _get_qubit_partition now does recursive balanced bisections.

* Added truncation_fidelity approach to TTNxGate

Co-authored-by: Iakov Polyak <45295461+yapolyak@users.noreply.github.com>

* Updated docstring.

---------

Co-authored-by: PabloAndresCQ <pablo.andres-martinez@cambridgequantum.com>
Co-authored-by: Iakov Polyak <45295461+yapolyak@users.noreply.github.com>
3 people authored Feb 2, 2024
commit 4317b14897b18bebfacf25dba07711171b727413
2 changes: 1 addition & 1 deletion docs/api.rst
Original file line number Diff line number Diff line change
@@ -3,4 +3,4 @@ API documentation

.. toctree::
modules/fullTN.rst
modules/mps.rst
modules/structured_state.rst
63 changes: 0 additions & 63 deletions docs/modules/mps.rst

This file was deleted.

61 changes: 61 additions & 0 deletions docs/modules/structured_state.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
Structured state evolution
==========================

.. automodule:: pytket.extensions.cutensornet.structured_state


Simulation
~~~~~~~~~~

.. autofunction:: pytket.extensions.cutensornet.structured_state.simulate

.. autoenum:: pytket.extensions.cutensornet.structured_state.SimulationAlgorithm()
:members:

.. autoclass:: pytket.extensions.cutensornet.structured_state.Config()

.. automethod:: __init__

.. autoclass:: pytket.extensions.cutensornet.structured_state.CuTensorNetHandle


Classes
~~~~~~~

.. autoclass:: pytket.extensions.cutensornet.structured_state.StructuredState()

.. automethod:: __init__
.. automethod:: is_valid
.. automethod:: apply_gate
.. automethod:: apply_scalar
.. automethod:: vdot
.. automethod:: sample
.. automethod:: measure
.. automethod:: postselect
.. automethod:: expectation_value
.. automethod:: get_fidelity
.. automethod:: get_statevector
.. automethod:: get_amplitude
.. automethod:: get_qubits
.. automethod:: get_byte_size
.. automethod:: get_device_id
.. automethod:: update_libhandle
.. automethod:: copy

.. autoclass:: pytket.extensions.cutensornet.structured_state.TTNxGate()

.. automethod:: __init__

.. autoclass:: pytket.extensions.cutensornet.structured_state.MPSxGate()

.. automethod:: __init__

.. autoclass:: pytket.extensions.cutensornet.structured_state.MPSxMPO()

.. automethod:: __init__


Miscellaneous
~~~~~~~~~~~~~

.. autofunction:: pytket.extensions.cutensornet.structured_state.prepare_circuit_mps
8 changes: 4 additions & 4 deletions examples/mpi/mpi_overlap_bcast_mps.py
Original file line number Diff line number Diff line change
@@ -42,10 +42,10 @@

from pytket.circuit import Circuit, fresh_symbol

from pytket.extensions.cutensornet.mps import (
from pytket.extensions.cutensornet.structured_state import (
simulate,
ConfigMPS,
ContractionAlg,
Config,
SimulationAlgorithm,
CuTensorNetHandle,
)

@@ -109,7 +109,7 @@
this_proc_mps = []
with CuTensorNetHandle(device_id) as libhandle: # Different handle for each process
for circ in this_proc_circs:
mps = simulate(libhandle, circ, ContractionAlg.MPSxGate, ConfigMPS())
mps = simulate(libhandle, circ, SimulationAlgorithm.MPSxGate, Config())
this_proc_mps.append(mps)

if rank == root:
2,260 changes: 1,122 additions & 1,138 deletions examples/mps_tutorial.ipynb

Large diffs are not rendered by default.

Loading