Skip to content

Commit 6b2d6bc

Browse files
committed
Updated pyqpp
Signed-off-by: Vlad Gheorghiu <vsoftco@gmail.com>
1 parent 29f9586 commit 6b2d6bc

18 files changed

Lines changed: 189 additions & 21 deletions

pyqpp/include/pyqpp/classes/gates_bind.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,16 @@
2424
* SOFTWARE.
2525
*/
2626

27+
/**
28+
* \file <pyqpp/classes/gates_bind.hpp>
29+
* \brief Bindings for <qpp/classes/gates.hpp>
30+
*/
31+
2732
#ifndef PYQPP_CLASSES_GATES_BIND_HPP_
2833
#define PYQPP_CLASSES_GATES_BIND_HPP_
2934

3035
#include "pyqpp/pyqpp_common.hpp"
3136

32-
/* qpp::Gates */
3337
inline void init_classes_gates(py::module_& m) {
3438
using namespace qpp;
3539

pyqpp/include/pyqpp/classes/qcircuit_bind.hpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
* SOFTWARE.
2525
*/
2626

27+
/**
28+
* \file <pyqpp/classes/qcircuit_bind.hpp>
29+
* \brief Bindings for <qpp/classes/qcircuit.hpp>
30+
*/
31+
2732
#ifndef PYQPP_CLASSES_QCIRCUIT_BIND_HPP_
2833
#define PYQPP_CLASSES_QCIRCUIT_BIND_HPP_
2934

@@ -34,9 +39,8 @@
3439

3540
namespace {
3641

37-
class WhileContext
38-
{
39-
public:
42+
class WhileContext {
43+
public:
4044
~WhileContext() = default;
4145
WhileContext(WhileContext&&) = default;
4246

@@ -45,11 +49,11 @@ class WhileContext
4549

4650
py::object enter();
4751

48-
bool exit(std::optional<pybind11::type> const& /* exc_type */,
52+
bool exit(std::optional<pybind11::type> const& /* exc_type */,
4953
std::optional<pybind11::object> const& /* exc_value */,
5054
std::optional<pybind11::object> const& /* traceback */);
5155

52-
private:
56+
private:
5357
qpp::QCircuit& managed;
5458

5559
explicit WhileContext(qpp::QCircuit& qc) : managed(qc) {}
@@ -59,8 +63,7 @@ class WhileContext
5963
WhileContext& operator=(WhileContext const&) = delete;
6064
};
6165

62-
WhileContext WhileContext::pyCreate(qpp::QCircuit& qc, qpp::cond_pred_t pred)
63-
{
66+
WhileContext WhileContext::pyCreate(qpp::QCircuit& qc, qpp::cond_pred_t pred) {
6467
qc.cond_while(pred);
6568
return WhileContext(qc);
6669
}
@@ -72,13 +75,12 @@ py::object WhileContext::enter() {
7275

7376
bool WhileContext::exit(std::optional<pybind11::type> const&,
7477
std::optional<pybind11::object> const&,
75-
std::optional<pybind11::object> const&)
76-
{
78+
std::optional<pybind11::object> const&) {
7779
managed.cond_end();
7880
return false; // do not supress exceptions that occurred
7981
}
8082

81-
} /* anonymous namespace (for context managers in Python wrapping) */
83+
} // namespace
8284

8385
/* qpp::QCircuit and related free functions */
8486
inline void init_classes_qcircuit(py::module_& m) {
@@ -124,7 +126,7 @@ inline void init_classes_qcircuit(py::module_& m) {
124126
// wrap context manager
125127
auto pyWhileContext = py::class_<WhileContext>(m, "CondWhile");
126128
pyWhileContext.def("__enter__", &WhileContext::enter)
127-
.def("__exit__", &WhileContext::exit);
129+
.def("__exit__", &WhileContext::exit);
128130

129131
pyQCircuit.def("cond_while_ctx", &WhileContext::pyCreate,
130132
"Adds conditional while context", py::arg("pred"));

pyqpp/include/pyqpp/classes/qdummy_engine_bind.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
* SOFTWARE.
2525
*/
2626

27+
/**
28+
* \file <pyqpp/classes/qdummy_engine_bind.hpp>
29+
* \brief Bindings for <qpp/classes/qdummy_engine.hpp>
30+
*/
31+
2732
#ifndef PYQPP_CLASSES_QDUMMY_ENGINE_BIND_HPP_
2833
#define PYQPP_CLASSES_QDUMMY_ENGINE_BIND_HPP_
2934

pyqpp/include/pyqpp/classes/qengine_bind.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
* SOFTWARE.
2525
*/
2626

27+
/**
28+
* \file <pyqpp/classes/qengine_bind.hpp>
29+
* \brief Bindings for <qpp/classes/qengine.hpp>
30+
*/
31+
2732
#ifndef PYQPP_CLASSES_QENGINE_BIND_HPP_
2833
#define PYQPP_CLASSES_QENGINE_BIND_HPP_
2934

pyqpp/include/pyqpp/classes/qnoisy_engine_bind.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
* SOFTWARE.
2525
*/
2626

27+
/**
28+
* \file <pyqpp/classes/qnoisy_engine_bind.hpp>
29+
* \brief Bindings for <qpp/classes/qnoisy_engine.hpp>
30+
*/
31+
2732
#ifndef PYQPP_CLASSES_QNOISY_ENGINE_BIND_HPP_
2833
#define PYQPP_CLASSES_QNOISY_ENGINE_BIND_HPP_
2934

pyqpp/include/pyqpp/classes/reversible_bind.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
* SOFTWARE.
2525
*/
2626

27+
/**
28+
* \file <pyqpp/classes/reversible_bind.hpp>
29+
* \brief Bindings for <qpp/classes/reversible.hpp>
30+
*/
31+
2732
#ifndef PYQPP_CLASSES_REVERSIBLE_BIND_HPP_
2833
#define PYQPP_CLASSES_REVERSIBLE_BIND_HPP_
2934

pyqpp/include/pyqpp/classes/states_bind.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,16 @@
2424
* SOFTWARE.
2525
*/
2626

27+
/**
28+
* \file <pyqpp/classes/states_bind.hpp>
29+
* \brief Bindings for <qpp/classes/states.hpp>
30+
*/
31+
2732
#ifndef PYQPP_CLASSES_STATES_BIND_HPP_
2833
#define PYQPP_CLASSES_STATES_BIND_HPP_
2934

3035
#include "pyqpp/pyqpp_common.hpp"
3136

32-
/* qpp::States */
3337
inline void init_classes_states(py::module_& m) {
3438
using namespace qpp;
3539

pyqpp/include/pyqpp/constants_bind.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,16 @@
2424
* SOFTWARE.
2525
*/
2626

27+
/**
28+
* \file <pyqpp/constants_bind.hpp>
29+
* \brief Bindings for <qpp/constants.hpp>
30+
*/
31+
2732
#ifndef PYQPP_CONSTANTS_BIND_HPP_
2833
#define PYQPP_CONSTANTS_BIND_HPP_
2934

3035
#include "pyqpp/pyqpp_common.hpp"
3136

32-
/* Bindings for constants.hpp */
3337
inline void init_constants(py::module_& m) {
3438
using namespace qpp;
3539

pyqpp/include/pyqpp/entanglement_bind.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,16 @@
2424
* SOFTWARE.
2525
*/
2626

27+
/**
28+
* \file <pyqpp/entanglement_bind.hpp>
29+
* \brief Bindings for <qpp/entanglement.hpp>
30+
*/
31+
2732
#ifndef PYQPP_ENTANGLEMENT_BIND_HPP_
2833
#define PYQPP_ENTANGLEMENT_BIND_HPP_
2934

3035
#include "pyqpp/pyqpp_common.hpp"
3136

32-
/* Bindings for entropies.hpp */
3337
inline void init_entanglement(py::module_& m) {
3438
using namespace qpp;
3539

pyqpp/include/pyqpp/entropies_bind.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,16 @@
2424
* SOFTWARE.
2525
*/
2626

27+
/**
28+
* \file <pyqpp/entropies_bind.hpp>
29+
* \brief Bindings for <qpp/entropies.hpp>
30+
*/
31+
2732
#ifndef PYQPP_ENTROPIES_BIND_HPP_
2833
#define PYQPP_ENTROPIES_BIND_HPP_
2934

3035
#include "pyqpp/pyqpp_common.hpp"
3136

32-
/* Bindings for entropies.hpp */
3337
inline void init_entropies(py::module_& m) {
3438
using namespace qpp;
3539

0 commit comments

Comments
 (0)