2
2
#include < igl/harmonic.h>
3
3
#include < nanobind/nanobind.h>
4
4
#include < nanobind/eigen/dense.h>
5
+ #include < nanobind/eigen/sparse.h>
5
6
6
7
namespace nb = nanobind;
7
8
using namespace nb ::literals;
@@ -23,6 +24,15 @@ namespace pyigl
23
24
}
24
25
return W;
25
26
}
27
+ auto harmonic_integrated_from_laplacian_and_mass (
28
+ const Eigen::SparseMatrixN &L,
29
+ const Eigen::SparseMatrixN &M,
30
+ const int k)
31
+ {
32
+ Eigen::SparseMatrixN Q;
33
+ igl::harmonic (L, M, k, Q);
34
+ return Q;
35
+ }
26
36
}
27
37
28
38
// Bind the wrapper to the Python module
@@ -44,4 +54,17 @@ R"(Compute k-harmonic weight functions "coordinates".
44
54
@param[in] bc #b by #W list of boundary values
45
55
@param[in] k power of harmonic operation (1: harmonic, 2: biharmonic, etc)
46
56
@return W #V by #W list of weights)" );
47
- }
57
+ m.def (
58
+ " harmonic_integrated_from_laplacian_and_mass" ,
59
+ &pyigl::harmonic_integrated_from_laplacian_and_mass,
60
+ " L" _a,
61
+ " M" _a,
62
+ " k" _a,
63
+ R"( Build the discrete k-harmonic operator (computing integrated quantities).
64
+ That is, if the k-harmonic PDE is Q x = 0, then this minimizes x' Q x.
65
+
66
+ @param[in] L #V by #V discrete (integrated) Laplacian
67
+ @param[in] M #V by #V mass matrix
68
+ @param[in] k power of harmonic operation (1: harmonic, 2: biharmonic, etc)
69
+ @return Q #V by #V discrete (integrated) k-Laplacian)" );
70
+ }
0 commit comments