-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feature/feature_buildout] Adding initial docs for the features we wa…
…nt implement
- Loading branch information
1 parent
fce60ba
commit 69e7c9a
Showing
5 changed files
with
63 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,3 +79,4 @@ __pycache__ | |
logs | ||
scratch | ||
notes | ||
.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# General | ||
|
||
|
||
## Notation | ||
|
||
- Pauli Matrix $\sigma_i \in \{ I,X,Y,Z \}$ | ||
- Pauli String $\mathcal{\hat{P}} = \bigotimes_i \sigma_i$ | ||
- Sum of weighted Pauli strings (currently called `PauliOp`) $A_k = \sum_i h_i \mathcal{\hat{P_i}}$ | ||
- Sum of summed weighted Pauli strings (currently called `SummedPauliOp`) $B = \sum_k \sum_i h_{ik} \mathcal{\hat{P_i}}$ | ||
|
||
# List of Operations | ||
|
||
Here's a terse list of the type of operations we want to support in `fast_pauli` (this list will grow over time): | ||
|
||
1. Pauli String to sparse matrix (Pauli Composer) | ||
2. $\mathcal{\hat{P}} \ket{\psi}$ | ||
3. $\mathcal{\hat{P}} \ket{\psi_t}$ | ||
4. $\big( \sum_i h_i \mathcal{\hat{P}}_i \big) \ket{\psi_t}$ | ||
5. $\big(\sum_k \sum_i h_{ik} \mathcal{\hat{P}}_i \big) \ket{\psi_t}$ | ||
6. $\big(\sum_k x_{tk} \sum_i h_{ik} \mathcal{\hat{P}}_i \big) \ket{\psi_t}$ | ||
7. $\bigg(\sum_k \big( \sum_i h_{ik} \mathcal{\hat{P}}_i \big)^2 \bigg) \ket{\psi_t}$ | ||
8. Calculate $\bra{\psi_t} \{ \mathcal{\hat{P_i}}, \hat{A_k} \} \ket{\psi}$ and $\bra{\psi} \mathcal{\hat{P_i}} \ket{\psi}$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include "fast_pauli.hpp" | ||
|
||
#include <experimental/mdspan> | ||
#include <pybind11/numpy.h> | ||
#include <pybind11/pybind11.h> | ||
#include <pybind11/stl.h> | ||
|
||
namespace py = pybind11; | ||
|
||
void scale_tensor_3d(py::array_t<double> array, double scale) { | ||
auto arr = array.mutable_unchecked<>(); | ||
std::mdspan tensor(arr.mutable_data(), arr.shape(0), arr.shape(1), | ||
arr.shape(2)); | ||
|
||
#pragma omp parallel for collapse(3) | ||
for (size_t i = 0; i < tensor.extent(0); i++) { | ||
for (size_t j = 0; j < tensor.extent(1); j++) { | ||
for (size_t k = 0; k < tensor.extent(2); k++) { | ||
tensor(i, j, k) *= scale; | ||
} | ||
} | ||
} | ||
} | ||
|
||
PYBIND11_MODULE(py_fast_pauli, m) { | ||
m.doc() = "Example NumPy/C++ Interface Using std::mdspan"; // optional module | ||
// docstring | ||
m.def("scale_tensor_3d", &scale_tensor_3d, "Scale a 3D tensor by a scalar.", | ||
py::arg().noconvert(), py::arg("scale")); | ||
|
||
py::class_<fast_pauli::SummedPauliOp<double>>(m, "SummedPauliOp") | ||
.def(py::init<>()); | ||
} |