-
Notifications
You must be signed in to change notification settings - Fork 43
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
Update Lightning API documentation #131
Changes from all commits
9375927
25c6321
73da0a1
914683a
ef86d85
f00efe0
4bf2050
989c005
54e249b
9facb8a
a45c9bd
5a19738
1e9d898
619d99a
87b7f2d
ca0be68
2dea5d3
0c42811
50f7cd9
90a767e
32651c2
c052cf3
42a9ab7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
Architecture overview | ||
===================== | ||
|
||
.. |br| raw:: html | ||
|
||
<br /> | ||
|
||
Lightning's purpose is to provide direct C++ kernels to manipulate the statevector data as created with PennyLane. Our design extends that of the "default.qubit" device in PennyLane, allowing direct access to the complex C-backed Numpy array data. This ensures we maintain all existing compatibility with PennyLane plugins, as only the gate-application is offloaded to C++. | ||
|
||
The following diagram represents the current architecture of Lightning using an adaption of the C4 container model. | ||
|
||
|br| | ||
|
||
.. image:: ../_static/arch/system_context.svg | ||
:width: 600 | ||
:alt: Example of a tensor network. | ||
:align: center | ||
|
||
|br| | ||
|
||
|
||
To understand the relationships between PennyLane, Lightning, and its components, we also present a component-level diagram. | ||
|
||
|br| | ||
|
||
|
||
.. image:: ../_static/arch/system_containers_components.svg | ||
:width: 600 | ||
:alt: Example of a tensor network. | ||
:align: center | ||
|
||
|br| | ||
|
||
The interactions provided allow us to develop and extend functionality from PennyLane to Lightning, whilst providing a clear boundary between different parts of the system. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
@startuml | ||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml | ||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml | ||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml | ||
' uncomment the following line and comment the first to use locally | ||
' !include C4_Context.puml | ||
|
||
LAYOUT_TOP_DOWN() | ||
|
||
title Component-level diagram for PennyLane Lightning | ||
|
||
Person(developer, "Quantum software developer") | ||
System(python, "Python", "Python 3.7+") | ||
|
||
System(pennylane, "PennyLane", "PennyLane quantum simulation library") | ||
|
||
System_Boundary(pennylane, "PennyLane") { | ||
Container(other, "Other", "Catch-all for rest of PennyLane library and tooling") | ||
Container(default_qubit, "default.qubit", "PennyLane Python-only simulation device") | ||
|
||
Container_Boundary(lightning, "lightning-qubit") { | ||
Component(lightning_qubit, "lightning_qubit", "C++/Python", "Python module front-end for C++ operations") | ||
|
||
Component(statevector, "StateVector", "C++", "C++ class for directly manipulating statevector data") | ||
Component(utils, "Utils", "C++", "Helper utilities for C++ operations") | ||
Component(gates, "Gates", "C++", "const/constexpr numerical representations of gates") | ||
Component(bindings, "Bindings", "C++, Pybind11", "Binds C++ classes, methods and functions to Python layer.") | ||
} | ||
} | ||
|
||
Rel(lightning_qubit, bindings, "Uses", "Bound methods wrapped to interface with PennyLane library") | ||
Rel_Neighbor(bindings, statevector, "Uses", "Wraps statevector to manipulate data using C++") | ||
Rel(statevector, utils, "Uses") | ||
|
||
System_Ext(tests, "Tests", "C++, CMake, Catch2") | ||
Rel(tests, statevector, "Uses") | ||
Rel(tests, gates, "Uses") | ||
|
||
Rel_Neighbor(other, default_qubit, "Uses", "Quantum circuit \n backends") | ||
Lay_L(other, default_qubit) | ||
|
||
Lay_D(python, other) | ||
|
||
Rel_Neighbor(developer, python, "Uses", "Win/MacOS/Lnx") | ||
|
||
Rel(python, other, "Uses") | ||
|
||
Rel(default_qubit, lightning_qubit, "Ops and data pointer", "Provides default \n Python plugin methods") | ||
|
||
@enduml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
@startuml | ||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml | ||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml | ||
' uncomment the following line and comment the first to use locally | ||
' !include C4_Context.puml | ||
|
||
LAYOUT_TOP_DOWN() | ||
|
||
title System-level component diagram for PennyLane using Lightning Qubit device | ||
|
||
Person(developer, "Quantum software developer") | ||
System(python, "Python", "Python 3.7+") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now I know that these are autogenerated from an easily-searcheable script, maybe putting Python 3.7 isn't so bad here! |
||
System(pennylane, "PennyLane", "PennyLane quantum simulation library") | ||
|
||
System_Boundary(pennylane, "PennyLane") { | ||
Container(other, "Other", "Catch-all for rest of PennyLane library and tooling") | ||
Container(default_qubit, "default.qubit", "PennyLane Python-only simulation device") | ||
|
||
Container(lightning, "lightning.qubit", "PennyLane Lightning C++ simulation library ⚡") | ||
} | ||
|
||
System_Ext(tests, "Tests", "C++, CMake, Catch2") | ||
|
||
Rel_Neighbor(developer, python, "Uses", "Win/MacOS/Lnx") | ||
|
||
Rel_D(python, other, "Uses") | ||
|
||
Rel_Neighbor(default_qubit, other, "Catch-all for rest of PennyLane library and tools") | ||
Rel_D(default_qubit, lightning, "Ops and data pointer", "Provides default \n Python plugin methods") | ||
Rel(tests, lightning, "Uses", "Tests for C++ gate kernels") | ||
|
||
|
||
@enduml |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,10 +26,16 @@ Supported operations and observables | |
|
||
~pennylane.BasisState | ||
~pennylane.CNOT | ||
~pennylane.CRot | ||
~pennylane.CRX | ||
~pennylane.CRY | ||
~pennylane.CRZ | ||
Comment on lines
+29
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good spot! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the long run, maybe we shouldn't even have this list of supported ops! Every op should be supported ⚡ (and saves us having to maintain this) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure --- do you think this entire list can be pulled? Or should we opt for that later? |
||
~pennylane.Hadamard | ||
~pennylane.PauliX | ||
~pennylane.PauliY | ||
~pennylane.PauliZ | ||
~pennylane.PhaseShift | ||
~pennylane.ControlledPhaseShift | ||
~pennylane.QubitStateVector | ||
~pennylane.Rot | ||
~pennylane.RX | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
docutils==0.16 | ||
sphinx | ||
sphinx-automodapi | ||
breathe | ||
exhale | ||
pybind11 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Though going forward will we still be following the philosophy of just offloading gate application to C++? E.g., if we override the whole execute method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is something to update as the architecture settles in. Maybe "our current design" to signify the existing implementation?