-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdiffusion_wrapper.cpp
More file actions
35 lines (32 loc) · 1.57 KB
/
diffusion_wrapper.cpp
File metadata and controls
35 lines (32 loc) · 1.57 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
33
34
35
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <pybind11/numpy.h>
#include <pybind11/eigen.h>
#include "diffusion.h"
namespace py = pybind11;
PYBIND11_MODULE(diffusion, m) {
/*py::class_<MatrixReplacement>(m, "MatrixReplacement")
.def(py::init<>())
.def("rows", &MatrixReplacement::rows)
.def("cols", &MatrixReplacement::cols)
.def("attachMyMatrix", &MatrixReplacement::attachMyMatrix)
.def("my_matrix", &MatrixReplacement::my_matrix);*/
py::class_<GraphSolver>(m, "GraphSolver")
.def(py::init<std::string, std::string, std::string, int>())
.def(py::init<int, int, Eigen::VectorXd, std::vector<std::vector<int>>, int, std::vector<int>, int>())
.def("infinity_subgradient", &GraphSolver::infinity_subgradient)
.def("diffusion", &GraphSolver::diffusion)
.def("compute_fx", &GraphSolver::compute_fx)
.def("compute_error", &GraphSolver::compute_error)
.def("run_diffusions", &GraphSolver::run_diffusions)
.def_readwrite("degree", &GraphSolver::degree)
.def_readwrite("hypergraph", &GraphSolver::hypergraph)
.def_readwrite("labels", &GraphSolver::labels)
.def_readwrite("label_count", &GraphSolver::label_count)
.def_readwrite("weights", &GraphSolver::weights)
.def_readwrite("hypergraph_node_weights", &GraphSolver::hypergraph_node_weights)
.def_readwrite("center_id", &GraphSolver::center_id)
.def_readwrite("early_stopping", &GraphSolver::early_stopping)
.def_readwrite("verbose", &GraphSolver::verbose)
;
}