Line data Source code
1 : // SPDX-FileCopyrightText: 2024 PairInteraction Developers
2 : // SPDX-License-Identifier: LGPL-3.0-or-later
3 :
4 : #include "./sorting.py.hpp"
5 :
6 : #include "pairinteraction/utils/IndicesOfBlocks.hpp"
7 : #include "pairinteraction/utils/eigen_assertion.hpp"
8 :
9 : #include <Eigen/Core>
10 : #include <nanobind/nanobind.h>
11 :
12 : namespace nb = nanobind;
13 : using namespace nb::literals;
14 : using namespace pairinteraction;
15 :
16 2 : static void declare_permutation_matrix(nb::module_ &m) {
17 : nb::class_<Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic>> pyclass(
18 2 : m, "PermutationMatrix");
19 2 : }
20 :
21 2 : static void declare_indices_of_blocks(nb::module_ &m) {
22 2 : nb::class_<IndicesOfBlock> pyclass(m, "IndicesOfBlock");
23 6 : pyclass.def(nb::init<size_t, size_t>(), "start"_a, "end"_a)
24 2 : .def_rw("start", &IndicesOfBlock::start)
25 : .def_rw("end", &IndicesOfBlock::end);
26 2 : }
27 :
28 2 : void bind_sorting(nb::module_ &m) {
29 2 : declare_permutation_matrix(m);
30 2 : declare_indices_of_blocks(m);
31 2 : }
|