Skip to content

Commit fa3e722

Browse files
Wentzellclaude
andcommitted
Regenerate c2py Python bindings
Co-Authored-By: Claude <noreply@anthropic.com>
1 parent a7c37b1 commit fa3e722

10 files changed

Lines changed: 451 additions & 789 deletions

python/triqs_xca/dense.wrap.cxx

Lines changed: 78 additions & 157 deletions
Large diffs are not rendered by default.

python/triqs_xca/dense.wrap.hxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include <c2py/c2py.hpp>
22

3-
#ifndef C2PY_HXX_DECLARATION_dense_GUARDS
4-
#define C2PY_HXX_DECLARATION_dense_GUARDS
5-
template <> constexpr bool c2py::is_wrapped<triqs_xca::dense::DenseDiagramEvaluator> = true;
6-
template <> inline constexpr auto c2py::tp_name<triqs_xca::dense::DenseDiagramEvaluator> = "triqs_xca.dense.DenseDiagramEvaluator";
3+
4+
#ifndef C2PY_HXX_DECLARATION_dense_GUARDS
5+
#define C2PY_HXX_DECLARATION_dense_GUARDS
6+
template <> constexpr bool c2py::is_wrapped<triqs_xca::dense::DenseDiagramEvaluator> = true;template <> inline constexpr auto c2py::tp_name<triqs_xca::dense::DenseDiagramEvaluator> = "triqs_xca.dense.DenseDiagramEvaluator";
77
#endif

python/triqs_xca/dlr_dyson_ppsc.wrap.cxx

Lines changed: 45 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -16,46 +16,23 @@
1616

1717
#include <c2py/c2py.hpp>
1818

19+
1920
using c2py::operator""_a;
2021

21-
// ==================== Wrapped classes =====================
22+
// ==================== enums =====================
2223

23-
template <>
24-
constexpr bool c2py::is_wrapped<cppdlr::dyson_it_ppsc<
25-
nda::basic_array<std::complex<double>, 2, nda::C_layout, 'A', nda::heap_basic<nda::mem::mallocator<nda::mem::AddressSpace::Host>>>,
26-
std::complex<double>>> = true;
2724

28-
// ==================== enums =====================
2925

3026
// ==================== module classes =====================
3127

32-
template <>
33-
inline constexpr auto c2py::tp_name<cppdlr::dyson_it_ppsc<
34-
nda::basic_array<std::complex<double>, 2, nda::C_layout, 'A', nda::heap_basic<nda::mem::mallocator<nda::mem::AddressSpace::Host>>>,
35-
std::complex<double>>> = "triqs_xca.dlr_dyson_ppsc.DysonItPPSC";
36-
static auto init_0 = c2py::dispatcher_c_kw_t{
37-
c2py::c_constructor<
38-
cppdlr::dyson_it_ppsc<
39-
nda::basic_array<std::complex<double>, 2, nda::C_layout, 'A', nda::heap_basic<nda::mem::mallocator<nda::mem::AddressSpace::Host>>>,
40-
std::complex<double>>,
41-
double, cppdlr::imtime_ops,
42-
const nda::basic_array<std::complex<double>, 2, nda::C_layout, 'A', nda::heap_basic<nda::mem::mallocator<nda::mem::AddressSpace::Host>>> &>(
43-
"beta", "itops", "h"),
44-
c2py::c_constructor<cppdlr::dyson_it_ppsc<nda::basic_array<std::complex<double>, 2, nda::C_layout, 'A',
45-
nda::heap_basic<nda::mem::mallocator<nda::mem::AddressSpace::Host>>>,
46-
std::complex<double>>,
47-
double, cppdlr::imtime_ops,
48-
const nda::basic_array_view<std::complex<double>, 3, nda::C_stride_layout, 'A', nda::default_accessor,
49-
nda::borrowed<nda::mem::AddressSpace::Host>> &>("beta", "itops", "g0")};
50-
template <>
51-
constexpr initproc c2py::tp_init<cppdlr::dyson_it_ppsc<
52-
nda::basic_array<std::complex<double>, 2, nda::C_layout, 'A', nda::heap_basic<nda::mem::mallocator<nda::mem::AddressSpace::Host>>>,
53-
std::complex<double>>> = c2py::pyfkw_constructor<init_0>;
54-
template <>
55-
const std::string c2py::tp_ctor_doc<cppdlr::dyson_it_ppsc<
56-
nda::basic_array<std::complex<double>, 2, nda::C_layout, 'A', nda::heap_basic<nda::mem::mallocator<nda::mem::AddressSpace::Host>>>,
57-
std::complex<double>>> =
58-
init_0.doc(R"DOC(
28+
29+
// --------- class _c2py_cls_0 -----------
30+
using _c2py_cls_0 = cppdlr::dyson_it_ppsc<nda::basic_array<std::complex<double>, 2, nda::C_layout, 'A', nda::heap_basic<nda::mem::mallocator<nda::mem::AddressSpace::Host>>>, std::complex<double>>;
31+
template <> constexpr bool c2py::is_wrapped<_c2py_cls_0> = true;
32+
template <> inline constexpr auto c2py::tp_name<_c2py_cls_0> = "triqs_xca.dlr_dyson_ppsc.DysonItPPSC"; static auto _c2py_init_0 = c2py::dispatcher_c_kw_t {
33+
c2py::c_constructor<_c2py_cls_0,double,cppdlr::imtime_ops,const nda::basic_array<std::complex<double>, 2, nda::C_layout, 'A', nda::heap_basic<nda::mem::mallocator<nda::mem::AddressSpace::Host>>>&>( "beta", "itops", "h"), c2py::c_constructor<_c2py_cls_0,double,cppdlr::imtime_ops,const nda::basic_array_view<std::complex<double>, 3, nda::C_stride_layout, 'A', nda::default_accessor, nda::borrowed<nda::mem::AddressSpace::Host>>&>( "beta", "itops", "g0")};
34+
template <> constexpr initproc c2py::tp_init<_c2py_cls_0> = c2py::pyfkw_constructor<_c2py_init_0>;
35+
template <> const std::string c2py::tp_ctor_doc<_c2py_cls_0> = _c2py_init_0.doc(R"DOC(
5936
[1] Constructor for dyson_it
6037
6138
.. note::
@@ -79,35 +56,14 @@ h : {par_2}
7956
Hamiltonian
8057
g0 : {par_3}
8158
Free imaginary time DLR pseudo-particle Green's function
82-
)DOC",
83-
{{c2py::python_typename<double>()},
84-
{c2py::python_typename<cppdlr::imtime_ops>()},
85-
{c2py::python_typename<const nda::basic_array<std::complex<double>, 2, nda::C_layout, 'A',
86-
nda::heap_basic<nda::mem::mallocator<nda::mem::AddressSpace::Host>>> &>()},
87-
{c2py::python_typename<const nda::basic_array_view<std::complex<double>, 3, nda::C_stride_layout, 'A', nda::default_accessor,
88-
nda::borrowed<nda::mem::AddressSpace::Host>> &>()}});
89-
// solve
90-
static auto const fun_0 = c2py::dispatcher_f_kw_t{c2py::cmethod(
91-
[](cppdlr::dyson_it_ppsc<
92-
nda::basic_array<std::complex<double>, 2, nda::C_layout, 'A', nda::heap_basic<nda::mem::mallocator<nda::mem::AddressSpace::Host>>>,
93-
std::complex<double>> &self,
94-
const nda::basic_array_view<std::complex<double>, 3, nda::C_stride_layout, 'A', nda::default_accessor,
95-
nda::borrowed<nda::mem::AddressSpace::Host>> &sig,
96-
double eta) { return self.solve(sig, eta); },
97-
"self", "sig", "eta")};
98-
99-
// solve_with_op
100-
static auto const fun_1 = c2py::dispatcher_f_kw_t{c2py::cmethod(
101-
[](cppdlr::dyson_it_ppsc<
102-
nda::basic_array<std::complex<double>, 2, nda::C_layout, 'A', nda::heap_basic<nda::mem::mallocator<nda::mem::AddressSpace::Host>>>,
103-
std::complex<double>> &self,
104-
const nda::basic_array_view<std::complex<double>, 3, nda::C_stride_layout, 'A', nda::default_accessor,
105-
nda::borrowed<nda::mem::AddressSpace::Host>> &sig,
106-
double eta, nda::matrix_view<cppdlr::dcomplex> op) { return self.solve_with_op(sig, eta, op); },
107-
"self", "sig", "eta", "op")};
108-
109-
static const auto doc_d_0 = fun_0.doc(
110-
R"DOC(
59+
)DOC", {{c2py::python_typename<double>()}, {c2py::python_typename<cppdlr::imtime_ops>()}, {c2py::python_typename<const nda::basic_array<std::complex<double>, 2, nda::C_layout, 'A', nda::heap_basic<nda::mem::mallocator<nda::mem::AddressSpace::Host>>>&>()}, {c2py::python_typename<const nda::basic_array_view<std::complex<double>, 3, nda::C_stride_layout, 'A', nda::default_accessor, nda::borrowed<nda::mem::AddressSpace::Host>>&>()}});
60+
// solve
61+
static auto const _c2py_fun_0 = c2py::dispatcher_f_kw_t{ c2py::cfun( &_c2py_cls_0::solve<nda::basic_array_view<std::complex<double>, 3, nda::C_stride_layout>,nda::basic_array<std::complex<double>, 3, nda::C_layout, 'A', nda::heap_basic<nda::mem::mallocator<>>>> , "sig", "eta") };
62+
63+
// solve_with_op
64+
static auto const _c2py_fun_1 = c2py::dispatcher_f_kw_t{ c2py::cfun( &_c2py_cls_0::solve_with_op<nda::basic_array_view<std::complex<double>, 3, nda::C_stride_layout>,nda::basic_array<std::complex<double>, 3, nda::C_layout, 'A', nda::heap_basic<nda::mem::mallocator<>>>> , "sig", "eta", "op") };
65+
66+
static const auto _c2py_doc_0 = _c2py_fun_0.doc(R"DOC(
11167
Solve pseudo-particle Dyson equation for given self-energy
11268
11369
.. note::
@@ -126,14 +82,8 @@ Returns
12682
-------
12783
{ret_0}
12884
Green's function at DLR imaginary time nodes
129-
)DOC",
130-
{{c2py::python_typename<const nda::basic_array_view<std::complex<double>, 3, nda::C_stride_layout, 'A', nda::default_accessor,
131-
nda::borrowed<nda::mem::AddressSpace::Host>> &>()},
132-
{c2py::python_typename<double>()}},
133-
{c2py::python_typename<
134-
nda::basic_array<std::complex<double>, 3, nda::C_layout, 'A', nda::heap_basic<nda::mem::mallocator<nda::mem::AddressSpace::Host>>>>()});
135-
static const auto doc_d_1 = fun_1.doc(
136-
R"DOC(
85+
)DOC", {{c2py::python_typename<const nda::basic_array_view<std::complex<double>, 3, nda::C_stride_layout, 'A', nda::default_accessor, nda::borrowed<nda::mem::AddressSpace::Host>>&>()}, {c2py::python_typename<double>()}}, {c2py::python_typename<nda::basic_array<std::complex<double>, 3, nda::C_layout, 'A', nda::heap_basic<nda::mem::mallocator<nda::mem::AddressSpace::Host>>>>()});
86+
static const auto _c2py_doc_1 = _c2py_fun_1.doc(R"DOC(
13787
Solve pseudo-particle Dyson equation for given self-energy, chemical potential, and operator.
13888
13989
.. note::
@@ -154,62 +104,37 @@ Returns
154104
-------
155105
{ret_0}
156106
Green's function at DLR imaginary time nodes
157-
)DOC",
158-
{{c2py::python_typename<const nda::basic_array_view<std::complex<double>, 3, nda::C_stride_layout, 'A', nda::default_accessor,
159-
nda::borrowed<nda::mem::AddressSpace::Host>> &>()},
160-
{c2py::python_typename<double>()},
161-
{c2py::python_typename<nda::matrix_view<cppdlr::dcomplex>>()}},
162-
{c2py::python_typename<
163-
nda::basic_array<std::complex<double>, 3, nda::C_layout, 'A', nda::heap_basic<nda::mem::mallocator<nda::mem::AddressSpace::Host>>>>()});
164-
165-
// ----- Method table ----
166-
template <>
167-
PyMethodDef c2py::tp_methods<cppdlr::dyson_it_ppsc<
168-
nda::basic_array<std::complex<double>, 2, nda::C_layout, 'A', nda::heap_basic<nda::mem::mallocator<nda::mem::AddressSpace::Host>>>,
169-
std::complex<double>>>[] = {
170-
{"solve", (PyCFunction)c2py::pyfkw<fun_0>, METH_VARARGS | METH_KEYWORDS, doc_d_0.c_str()},
171-
{"solve_with_op", (PyCFunction)c2py::pyfkw<fun_1>, METH_VARARGS | METH_KEYWORDS, doc_d_1.c_str()},
172-
{nullptr, nullptr, 0, nullptr} // Sentinel
173-
};
107+
)DOC", {{c2py::python_typename<const nda::basic_array_view<std::complex<double>, 3, nda::C_stride_layout, 'A', nda::default_accessor, nda::borrowed<nda::mem::AddressSpace::Host>>&>()}, {c2py::python_typename<double>()}, {c2py::python_typename<nda::basic_array_view<std::complex<double>, 2, nda::C_stride_layout, 'M', nda::default_accessor, nda::borrowed<nda::mem::AddressSpace::Host>>>()}}, {c2py::python_typename<nda::basic_array<std::complex<double>, 3, nda::C_layout, 'A', nda::heap_basic<nda::mem::mallocator<nda::mem::AddressSpace::Host>>>>()});
174108

175-
// ----- Method table ----
109+
// ----- Method table ----
110+
template <> PyMethodDef c2py::tp_methods<_c2py_cls_0>[] = {
111+
{"solve", (PyCFunction)c2py::pyfkw<_c2py_fun_0>, METH_VARARGS | METH_KEYWORDS , _c2py_doc_0.c_str()}, {"solve_with_op", (PyCFunction)c2py::pyfkw<_c2py_fun_1>, METH_VARARGS | METH_KEYWORDS , _c2py_doc_1.c_str()},
112+
{nullptr, nullptr, 0, nullptr} // Sentinel
113+
};
176114

177-
template <>
178-
constinit PyGetSetDef c2py::tp_getset<cppdlr::dyson_it_ppsc<
179-
nda::basic_array<std::complex<double>, 2, nda::C_layout, 'A', nda::heap_basic<nda::mem::mallocator<nda::mem::AddressSpace::Host>>>,
180-
std::complex<double>>>[] = {
115+
116+
template <> const std::string c2py::tp_doc<_c2py_cls_0> = R"DOC(Class for solving the pseudo-particle Dyson equation in imaginary time)DOC" + std::string{"\n\n----------\n\n"} + c2py::tp_ctor_doc<_c2py_cls_0>;
117+
118+
// ==================== module functions ====================
181119

182-
{nullptr, nullptr, nullptr, nullptr, nullptr}};
183120

184-
template <>
185-
const std::string c2py::tp_doc<cppdlr::dyson_it_ppsc<
186-
nda::basic_array<std::complex<double>, 2, nda::C_layout, 'A', nda::heap_basic<nda::mem::mallocator<nda::mem::AddressSpace::Host>>>,
187-
std::complex<double>>> = R"DOC(Class for solving the pseudo-particle Dyson equation in imaginary time)DOC" + std::string{"\n\n----------\n\n"}
188-
+ c2py::tp_ctor_doc<cppdlr::dyson_it_ppsc<
189-
nda::basic_array<std::complex<double>, 2, nda::C_layout, 'A', nda::heap_basic<nda::mem::mallocator<nda::mem::AddressSpace::Host>>>,
190-
std::complex<double>>>;
191121

192-
// ==================== module functions ====================
193122

194123
//--------------------- module function table -----------------------------
195124

196125
static PyMethodDef module_methods[] = {
197-
{nullptr, nullptr, 0, nullptr} // Sentinel
126+
{nullptr, nullptr, 0, nullptr} // Sentinel
198127
};
199128

200129
//--------------------- module struct & init error definition ------------
201130

202131
//// module doc directly in the code or "" if not present...
203132
/// Or mandatory ?
204-
static struct PyModuleDef module_def = {PyModuleDef_HEAD_INIT,
205-
"dlr_dyson_ppsc", /* name of module */
206-
R"RAWDOC()RAWDOC", /* module documentation, may be NULL */
207-
-1, /* size of per-interpreter state of the module, or -1 if the module keeps state in global variables. */
208-
module_methods,
209-
NULL,
210-
NULL,
211-
NULL,
212-
NULL};
133+
static struct PyModuleDef module_def = {
134+
PyModuleDef_HEAD_INIT, "dlr_dyson_ppsc", /* name of module */
135+
R"RAWDOC()RAWDOC", /* module documentation, may be NULL */
136+
-1, /* size of per-interpreter state of the module, or -1 if the module keeps state in global variables. */
137+
module_methods, NULL, NULL, NULL, NULL};
213138

214139
//--------------------- module init function -----------------------------
215140

@@ -225,22 +150,22 @@ extern "C" __attribute__((visibility("default"))) PyObject *PyInit_dlr_dyson_pps
225150
PyObject *m;
226151

227152
if (PyType_Ready(&c2py::wrap_pytype<c2py::py_range>) < 0) return NULL;
228-
if (PyType_Ready(
229-
&c2py::wrap_pytype<cppdlr::dyson_it_ppsc<
230-
nda::basic_array<std::complex<double>, 2, nda::C_layout, 'A', nda::heap_basic<nda::mem::mallocator<nda::mem::AddressSpace::Host>>>,
231-
std::complex<double>>>)
232-
< 0)
233-
return NULL;
153+
if (PyType_Ready(&c2py::wrap_pytype<_c2py_cls_0>) < 0) return NULL;
234154

235155
m = PyModule_Create(&module_def);
236156
if (m == NULL) return NULL;
237157

238158
auto &conv_table = *c2py::conv_table_sptr.get();
239159

240160
conv_table[std::type_index(typeid(c2py::py_range)).name()] = &c2py::wrap_pytype<c2py::py_range>;
241-
c2py::add_type_object_to_main<cppdlr::dyson_it_ppsc<
242-
nda::basic_array<std::complex<double>, 2, nda::C_layout, 'A', nda::heap_basic<nda::mem::mallocator<nda::mem::AddressSpace::Host>>>,
243-
std::complex<double>>>("DysonItPPSC", m, conv_table);
161+
#define _add_type(T, N) c2py::add_type_object_to_main<T>(N, m, conv_table)
162+
_add_type(_c2py_cls_0, "DysonItPPSC");
163+
#undef _add_type
164+
165+
166+
167+
168+
244169

245170
return m;
246171
}
Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
#include <c2py/c2py.hpp>
22

3-
#ifndef C2PY_HXX_DECLARATION_dlr_dyson_ppsc_GUARDS
4-
#define C2PY_HXX_DECLARATION_dlr_dyson_ppsc_GUARDS
5-
template <>
6-
constexpr bool c2py::is_wrapped<cppdlr::dyson_it_ppsc<
7-
nda::basic_array<std::complex<double>, 2, nda::C_layout, 'A', nda::heap_basic<nda::mem::mallocator<nda::mem::AddressSpace::Host>>>,
8-
std::complex<double>>> = true;
9-
template <>
10-
inline constexpr auto c2py::tp_name<cppdlr::dyson_it_ppsc<
11-
nda::basic_array<std::complex<double>, 2, nda::C_layout, 'A', nda::heap_basic<nda::mem::mallocator<nda::mem::AddressSpace::Host>>>,
12-
std::complex<double>>> = "triqs_xca.dlr_dyson_ppsc.DysonItPPSC";
3+
4+
#ifndef C2PY_HXX_DECLARATION_dlr_dyson_ppsc_GUARDS
5+
#define C2PY_HXX_DECLARATION_dlr_dyson_ppsc_GUARDS
6+
template <> constexpr bool c2py::is_wrapped<cppdlr::dyson_it_ppsc<nda::basic_array<std::complex<double>, 2, nda::C_layout, 'A', nda::heap_basic<nda::mem::mallocator<nda::mem::AddressSpace::Host>>>, std::complex<double>>> = true;template <> inline constexpr auto c2py::tp_name<cppdlr::dyson_it_ppsc<nda::basic_array<std::complex<double>, 2, nda::C_layout, 'A', nda::heap_basic<nda::mem::mallocator<nda::mem::AddressSpace::Host>>>, std::complex<double>>> = "triqs_xca.dlr_dyson_ppsc.DysonItPPSC";
137
#endif

0 commit comments

Comments
 (0)