Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
donghufeng committed Jul 28, 2023
1 parent d196c66 commit ffff36f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
3 changes: 1 addition & 2 deletions ccsrc/include/core/numba_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ struct NumbaMatFunWrapper {
using mat_t = void (*)(double, std::complex<double>*);
NumbaMatFunWrapper() = default;
NumbaMatFunWrapper(uint64_t addr, int dim, tensor::TDtype dtype = tensor::TDtype::Complex128)
: dim(dim), dtype(dtype) {
fun = reinterpret_cast<mat_t>(addr);
: fun(reinterpret_cast<mat_t>(addr)), dim(dim), dtype(dtype) {
}

auto operator()(double coeff) const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#define INCLUDE_VECTOR_DETAIL_CPU_VECTOR_AVX_DOUBLE_POLICY_HPP
#include <vector>

#include "simulator/alignedallocator.h"
#include "simulator/cintrin.h"
#include "simulator/vector/detail/cpu_vector_policy.h"
#define INTRIN_M2_dot_V2(ket, i, j, mm, mmt, res) \
Expand Down
2 changes: 2 additions & 0 deletions ccsrc/python/device/include/python/device/binding.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ namespace py = pybind11;
using namespace pybind11::literals; // NOLINT(build/namespaces_literals)

namespace mm = mindquantum::mapping;
namespace {
void BindTopology(py::module &module) { // NOLINT(runtime/references)
auto qnode_module
= py::class_<mm::QubitNode, std::shared_ptr<mm::QubitNode>>(module, "QubitNode")
Expand Down Expand Up @@ -128,4 +129,5 @@ void BindQubitMapping(py::module &module) { // NOLINT(runtime/references)
"Solve qubit mapping problem with saber method.");
saber_m.doc() = "SABER method to implement qubit mapping task.";
}
} // namespace
#endif
2 changes: 2 additions & 0 deletions ccsrc/python/math/include/python/python_tensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "math/tensor/ops_cpu/memory_operator.h"
#include "math/tensor/tensor.h"

namespace {
template <typename T>
tensor::Tensor from_numpy(const pybind11::array_t<T> &arr) {
pybind11::buffer_info buf = arr.request();
Expand All @@ -31,4 +32,5 @@ tensor::Tensor from_numpy(const pybind11::array_t<T> &arr) {
}
return tensor::ops::cpu::copy<tensor::to_dtype_v<T>>(buf.ptr, buf.size);
}
} // namespace
#endif /* PYTHON_TENSOR_HPP_ */
6 changes: 4 additions & 2 deletions ccsrc/python/math/lib/bind_math.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ using namespace pybind11::literals; // NOLINT(build/namespaces_literals)
.def(std::complex<float>() op py::self) \
.def(std::complex<double>() op py::self)

namespace {
void BindTensor(py::module &module) { // NOLINT(runtime/references)
py::class_<tensor::Tensor, std::shared_ptr<tensor::Tensor>>(module, "Tensor", py::buffer_protocol())
.def(py::init<>())
Expand Down Expand Up @@ -111,8 +112,6 @@ void BindTensor(py::module &module) { // NOLINT(runtime/references)
.def(py::init<const std::vector<std::vector<std::complex<double>>> &, tensor::TDevice>(), "m"_a,
"device"_a = tensor::TDevice::CPU);
}
#undef BIND_TENSOR_OPS
#undef BIND_TENSOR_OPS_REV

void BindPR(py::module &module) { // NOLINT(runtime/references)
namespace pr = parameter;
Expand Down Expand Up @@ -303,6 +302,9 @@ void BindTransform(py::module &module) { // NOLINT(runtime/references)
module.def("ternary_tree", &operators::transform::ternary_tree, "ops"_a, "n_qubits"_a);
module.def("bravyi_kitaev_superfast", &operators::transform::bravyi_kitaev_superfast, "ops"_a);
}
} // namespace
#undef BIND_TENSOR_OPS
#undef BIND_TENSOR_OPS_REV

PYBIND11_MODULE(_math, m) {
m.doc() = "MindQuantum Math module.";
Expand Down

0 comments on commit ffff36f

Please sign in to comment.