|
22 | 22 | #include <pybind11/stl_bind.h>
|
23 | 23 | namespace py = pybind11;
|
24 | 24 |
|
| 25 | +#include <map> |
25 | 26 | #include <vector>
|
26 | 27 |
|
27 | 28 | #include "../lib/circuit.h"
|
@@ -75,12 +76,17 @@ void add_channel(const unsigned time,
|
75 | 76 | prob_matrix_unitary_triples,
|
76 | 77 | qsim::NoisyCircuit<qsim::Cirq::GateCirq<float>>* ncircuit);
|
77 | 78 |
|
78 |
| -// Method for populating opstrings. |
| 79 | +// Methods for populating opstrings. |
79 | 80 | void add_gate_to_opstring(
|
80 | 81 | const qsim::Cirq::GateKind gate_kind,
|
81 | 82 | const std::vector<unsigned>& qubits,
|
82 | 83 | qsim::OpString<qsim::Cirq::GateCirq<float>>* opstring);
|
83 | 84 |
|
| 85 | +void add_matrix_gate_to_opstring( |
| 86 | + const std::vector<unsigned>& qubits, |
| 87 | + const std::vector<float>& matrix, |
| 88 | + qsim::OpString<qsim::Cirq::GateCirq<float>>* opstring); |
| 89 | + |
84 | 90 | // Methods for simulating noiseless circuits.
|
85 | 91 | std::vector<std::complex<float>> qsim_simulate(const py::dict &options);
|
86 | 92 |
|
@@ -376,7 +382,9 @@ std::vector<std::complex<float>> qsimh_simulate(const py::dict &options);
|
376 | 382 | "Adds a channel to the given noisy circuit."); \
|
377 | 383 | \
|
378 | 384 | m.def("add_gate_to_opstring", &add_gate_to_opstring, \
|
379 |
| - "Adds a gate to the given opstring."); |
| 385 | + "Adds a gate to the given opstring."); \ |
| 386 | + m.def("add_matrix_gate_to_opstring", &add_matrix_gate_to_opstring, \ |
| 387 | + "Adds a matrix gate to the given opstring."); |
380 | 388 |
|
381 | 389 | #define GPU_MODULE_BINDINGS \
|
382 | 390 | m.doc() = "pybind11 plugin"; /* optional module docstring */ \
|
|
0 commit comments