Skip to content

Commit

Permalink
Doc section about projectors.
Browse files Browse the repository at this point in the history
  • Loading branch information
RolandMacDoland committed Dec 13, 2023
1 parent 61e6a72 commit cb728e1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/advanced_tutorials/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
In this section, advanced programming concepts and implementations in Qadence are examplified.
20 changes: 20 additions & 0 deletions docs/advanced_tutorials/projectors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
This section introduces the `ProjectorBlock` (defined [here](qadence.blocks.primitive.ProjectorBlock)) as an implementation for the the quantum mechanical projection operation. It evaluates to the outer product of a ket and a bra expressed as bitstrings.

!!! warning
Projectors lead to non-unitary computations.


```python exec="on" source="material-block" session="noise" result="json"
from qadence.blocks import block_to_tensor
from qadence.operations import Projector # Projector as an operation.


projector_block = Projector(ket="1", bra="1", qubit_support=0)

# As any block, the matrix representation can be retrieved.
projector_matrix = block_to_tensor(projector_block)

print(f"projector matrix = {projector_matrix}") # markdown-exec: hide
```

Other standard operations can be expressed as projectors: for instance projector controlled-unitary gates or the number operator $N$.

0 comments on commit cb728e1

Please sign in to comment.