You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Complete all tests
* Complete all gate implementations
* Add compile-time tests
* Refactor `DynamicDispatcher` and gate implementations.
Co-authored-by: Lee James O'Riordan <[email protected]>
Co-authored-by: Ali Asadi <[email protected]>
We discuss how one can add another gate implementation in this document. Assume that you want to add a custom ``PauliX`` gate implementation in Pennylane-Lightning. In this case, you may first add a template class as:
6
+
We discuss how one can add another gate implementation in this document. Assume that you want to add a custom ``PauliX`` gate implementation in Pennylane-Lightning. In this case, you may first create a file and add a class:
will make your implementation as default kernel for ``PauliX`` gate (for all C++ call as well as for the Python binding).
104
+
will make your implementation as default kernel for ``PauliX`` gate (for all C++ calls as well as for the Python binding).
105
+
106
+
Gate generators can also be handled in the same way.
107
+
108
+
Test your gate implementation
109
+
=============================
110
+
111
+
To test your own kernel implementations, you can go to ``tests/TestKernels.hpp`` and add your implementation.
112
+
113
+
.. code-block:: cpp
114
+
115
+
using TestKernels = Pennylane::Util::TypeList<Pennylane::Gates::GateImplementationsLM,
116
+
Pennylane::Gates::GateImplementationsPI,
117
+
MyGateImplementation /*This is added */>;
118
+
119
+
It will automatically test your gate implementation.
120
+
Note that, in the current implementation, this will test a gate if ``apply + gate name`` is defined even when the gate is not included in ``implemented_gates`` variable.
0 commit comments