Skip to content

Commit b2867c2

Browse files
committed
Fixed pyqpp ket->numpy array via casting to cmat
Signed-off-by: Vlad Gheorghiu <vsoftco@gmail.com>
1 parent b425aae commit b2867c2

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

pyqpp/include/pyqpp/classes/qengine_bind.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ void declare_QEngineT(py::module& m) {
7777
"Vector of qudit indexes that were not measured destructively");
7878
pyQEngineT.def("get_probs", &QEngineT<T>::get_probs,
7979
"Underlying measurement outcome probabilities");
80-
pyQEngineT.def("get_state", &QEngineT<T>::get_state,
81-
"Underlying quantum state");
80+
pyQEngineT.def(
81+
"get_state",
82+
[](const QEngineT<T>& self) -> qpp::cmat { return self.get_state(); },
83+
"Underlying quantum state");
8284
pyQEngineT.def(
8385
"get_stats",
8486
[](const QEngineT<T>& qe) {

pyqpp/include/pyqpp/pyqpp_common.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#ifndef PYQPP_COMMON_H_
2828
#define PYQPP_COMMON_H_
2929

30+
#include <pybind11/complex.h>
3031
#include <pybind11/eigen.h>
3132
#include <pybind11/operators.h>
3233
#include <pybind11/pybind11.h>

0 commit comments

Comments
 (0)