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;
48 .def(
"get_indices_of_blocks_without_checks",
54 .def(
"get_amplitudes",
57 .def(
"get_amplitudes",
64 .def(
"get_matrix_elements",
67 .def(
"get_matrix_elements",
68 nb::overload_cast<std::shared_ptr<const T>,
OperatorType,
int>(
70 .def(
"get_corresponding_state",
72 .def(
"get_corresponding_state",
75 .def(
"get_corresponding_state_index",
77 .def(
"get_corresponding_state_index",
80 .def(
"get_corresponding_ket",
82 .def(
"get_corresponding_ket",
85 .def(
"get_corresponding_ket_index",
87 .def(
"get_corresponding_ket_index",
93static void declare_basis_atom(nb::module_ &m, std::string
const &type_name) {
94 std::string pyclass_name =
"BasisAtom" + type_name;
99static void declare_basis_atom_creator(nb::module_ &m, std::string
const &type_name) {
100 std::string pyclass_name =
"BasisAtomCreator" + type_name;
101 nb::class_<BasisAtomCreator<T>> pyclass(m, pyclass_name.c_str());
102 pyclass.def(nb::init<>())
121static void declare_basis_pair(nb::module_ &m, std::string
const &type_name) {
122 std::string pyclass_name =
"BasisPair" + type_name;
125 .def(
"get_amplitudes",
126 nb::overload_cast<std::shared_ptr<const KetAtom>, std::shared_ptr<const KetAtom>>(
128 .def(
"get_amplitudes",
133 nb::overload_cast<std::shared_ptr<const KetAtom>, std::shared_ptr<const KetAtom>>(
139 .def(
"get_matrix_elements",
142 .def(
"get_matrix_elements",
146 .def(
"get_matrix_elements",
150 .def(
"get_matrix_elements",
151 nb::overload_cast<std::shared_ptr<const KetAtom>, std::shared_ptr<const KetAtom>,
157static void declare_basis_pair_creator(nb::module_ &m, std::string
const &type_name) {
158 std::string pyclass_name =
"BasisPairCreator" + type_name;
159 nb::class_<BasisPairCreator<T>> pyclass(m, pyclass_name.c_str());
160 pyclass.def(nb::init<>())
169 declare_basis<BasisAtom<double>>(m,
"BasisAtomReal");
170 declare_basis<BasisAtom<std::complex<double>>>(m,
"BasisAtomComplex");
171 declare_basis_atom<double>(m,
"Real");
172 declare_basis_atom<std::complex<double>>(m,
"Complex");
173 declare_basis_atom_creator<double>(m,
"Real");
174 declare_basis_atom_creator<std::complex<double>>(m,
"Complex");
176 declare_basis<BasisPair<double>>(m,
"BasisPairReal");
177 declare_basis<BasisPair<std::complex<double>>>(m,
"BasisPairComplex");
178 declare_basis_pair<double>(m,
"Real");
179 declare_basis_pair<std::complex<double>>(m,
"Complex");
180 declare_basis_pair_creator<double>(m,
"Real");
181 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