Notebook source code: notebooks/how_to/01_mesh_laplacian.ipynb
Run it yourself on binder Binder badge

How to compute the mesh Laplacian?#

 In [1]:
from geomfum.dataset import NotebooksDataset
from geomfum.laplacian import LaplacianFinder
from geomfum.shape import TriangleMesh

Load a mesh.

 In [2]:
dataset = NotebooksDataset()
mesh = TriangleMesh.from_file(dataset.get_filename("cat-00"))

Find Laplacian.

 In [6]:
laplacian_finder = LaplacianFinder()
 In [7]:
stiffness_matrix, mass_matrix = laplacian_finder(mesh)

(stiffness_matrix.shape, mass_matrix.shape)
 Out [7]:
((7207, 7207), (7207, 7207))

Tip: different algorithms can be used by changing which (check docs for possibilities).

Syntax sugar:

 In [8]:
mesh.laplacian.find(laplacian_finder=laplacian_finder, recompute=False)

(mesh.laplacian.stiffness_matrix.shape, mesh.laplacian.mass_matrix.shape)
 Out [8]:
((7207, 7207), (7207, 7207))

Further reading#