Skip to content

Commit

Permalink
WIP on ClExprOp.
Browse files Browse the repository at this point in the history
  • Loading branch information
cqc-alec committed Oct 21, 2024
1 parent 7f768de commit cce0ca1
Show file tree
Hide file tree
Showing 20 changed files with 1,997 additions and 45 deletions.
1 change: 1 addition & 0 deletions pytket/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ pybind11_add_module(circuit
binders/circuit/Circuit/add_op.cpp
binders/circuit/Circuit/main.cpp
binders/circuit/classical.cpp
binders/circuit/clexpr.cpp
binders/circuit/main.cpp
${HEADER_FILES})
target_include_directories(circuit PRIVATE binders/include)
Expand Down
16 changes: 16 additions & 0 deletions pytket/binders/circuit/Circuit/add_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@
// limitations under the License.

#include <pybind11/pybind11.h>
#include <pybind11/pytypes.h>
#include <pybind11/stl.h>

#include <Ops/ClExpr.hpp>
#include <memory>
#include <optional>
#include <vector>

Expand Down Expand Up @@ -483,6 +486,19 @@ void init_circuit_add_op(py::class_<Circuit, std::shared_ptr<Circuit>> &c) {
":param args: Indices of the qubits to append the box to"
"\n:return: the new :py:class:`Circuit`",
py::arg("expression"), py::arg("target"))
.def(
"add_clexpr",
[](Circuit *circ, const WiredClExpr &expr,
const py::tket_custom::SequenceVec<Bit> &args,
const py::kwargs &kwargs) {
Op_ptr op = std::make_shared<ClExprOp>(expr);
return add_gate_method<Bit>(circ, op, args, kwargs);
},
"Append a :py:class:`WiredClExpr` to the circuit.\n\n"
":param expr: The expression to append\n"
":param args: The bits to apply the expression to\n"
":return: the new :py:class:`Circuit`",
py::arg("expr"), py::arg("args"))
.def(
"add_custom_gate",
[](Circuit *circ, const composite_def_ptr_t &definition,
Expand Down
Loading

0 comments on commit cce0ca1

Please sign in to comment.