-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathTriangularMap.cpp
More file actions
32 lines (26 loc) · 1.21 KB
/
TriangularMap.cpp
File metadata and controls
32 lines (26 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "CommonPybindUtilities.h"
#include "MParT/TriangularMap.h"
#include "MParT/ConditionalMapBase.h"
#include <pybind11/stl.h>
#include <pybind11/eigen.h>
#include <Kokkos_Core.hpp>
#include <pybind11/pybind11.h>
namespace py = pybind11;
using namespace mpart::binding;
template<typename MemorySpace>
void mpart::binding::TriangularMapWrapper(py::module &m)
{
std::string tName = "TriangularMap";
if(!std::is_same<MemorySpace,Kokkos::HostSpace>::value) tName = "d" + tName;
// TriangularMap
py::class_<TriangularMap<MemorySpace>, ConditionalMapBase<MemorySpace>, std::shared_ptr<TriangularMap<MemorySpace>>>(m, tName.c_str())
.def(py::init<std::vector<std::shared_ptr<ConditionalMapBase<MemorySpace>>>, bool>(), py::arg("comps"), py::arg("moveCoeffs") = false)
.def("GetComponent", &TriangularMap<MemorySpace>::GetComponent)
.def("Slice", &TriangularMap<MemorySpace>::Slice)
.def("__getitem__", &TriangularMap<MemorySpace>::GetComponent)
;
}
template void mpart::binding::TriangularMapWrapper<Kokkos::HostSpace>(py::module&);
#if defined(MPART_ENABLE_GPU)
template void mpart::binding::TriangularMapWrapper<mpart::DeviceSpace>(py::module&);
#endif // MPART_ENABLE_GPU