17#include <nanobind/eigen/sparse.h>
18#include <nanobind/nanobind.h>
19#include <nanobind/stl/complex.h>
20#include <nanobind/stl/set.h>
21#include <nanobind/stl/shared_ptr.h>
22#include <nanobind/stl/string.h>
23#include <nanobind/stl/vector.h>
25namespace nb = nanobind;
29static void declare_basis(nb::module_ &m, std::string
const &type_name) {
30 std::string pyclass_name =
"Basis" + type_name;
47 .def(
"get_indices_of_blocks_without_checks",
53 .def(
"get_amplitudes",
56 .def(
"get_amplitudes",
63 .def(
"get_matrix_elements",
66 .def(
"get_matrix_elements",
67 nb::overload_cast<std::shared_ptr<const T>,
OperatorType,
int>(
69 .def(
"get_corresponding_state",
71 .def(
"get_corresponding_state",
74 .def(
"get_corresponding_state_index",
76 .def(
"get_corresponding_state_index",
79 .def(
"get_corresponding_ket",
81 .def(
"get_corresponding_ket",
84 .def(
"get_corresponding_ket_index",
86 .def(
"get_corresponding_ket_index",
92static void declare_basis_atom(nb::module_ &m, std::string
const &type_name) {
93 std::string pyclass_name =
"BasisAtom" + type_name;
98static void declare_basis_atom_creator(nb::module_ &m, std::string
const &type_name) {
99 std::string pyclass_name =
"BasisAtomCreator" + type_name;
100 nb::class_<BasisAtomCreator<T>> pyclass(m, pyclass_name.c_str());
101 pyclass.def(nb::init<>())
117static void declare_basis_pair(nb::module_ &m, std::string
const &type_name) {
118 std::string pyclass_name =
"BasisPair" + type_name;
121 .def(
"get_amplitudes",
122 nb::overload_cast<std::shared_ptr<const KetAtom>, std::shared_ptr<const KetAtom>>(
124 .def(
"get_amplitudes",
129 nb::overload_cast<std::shared_ptr<const KetAtom>, std::shared_ptr<const KetAtom>>(
135 .def(
"get_matrix_elements",
138 .def(
"get_matrix_elements",
142 .def(
"get_matrix_elements",
146 .def(
"get_matrix_elements",
147 nb::overload_cast<std::shared_ptr<const KetAtom>, std::shared_ptr<const KetAtom>,
153static void declare_basis_pair_creator(nb::module_ &m, std::string
const &type_name) {
154 std::string pyclass_name =
"BasisPairCreator" + type_name;
155 nb::class_<BasisPairCreator<T>> pyclass(m, pyclass_name.c_str());
156 pyclass.def(nb::init<>())
165 declare_basis<BasisAtom<double>>(m,
"BasisAtomReal");
166 declare_basis<BasisAtom<std::complex<double>>>(m,
"BasisAtomComplex");
167 declare_basis_atom<double>(m,
"Real");
168 declare_basis_atom<std::complex<double>>(m,
"Complex");
169 declare_basis_atom_creator<double>(m,
"Real");
170 declare_basis_atom_creator<std::complex<double>>(m,
"Complex");
172 declare_basis<BasisPair<double>>(m,
"BasisPairReal");
173 declare_basis<BasisPair<std::complex<double>>>(m,
"BasisPairComplex");
174 declare_basis_pair<double>(m,
"Real");
175 declare_basis_pair<std::complex<double>>(m,
"Complex");
176 declare_basis_pair_creator<double>(m,
"Real");
177 declare_basis_pair_creator<std::complex<double>>(m,
"Complex");
void bind_basis(nb::module_ &m)
Builder class for creating BasisAtom objects.
Class for creating a basis of atomic kets.
typename traits::CrtpTraits< Type >::ket_t ket_t
typename traits::CrtpTraits< Derived >::scalar_t scalar_t
typename traits::CrtpTraits< Derived >::ket_t ket_t