Skip to content

Cholmod: Laplacian matrix not positive definite #12

@rezss

Description

@rezss

Hey,
I really appreciate your work with that library.

I have a small issue (or lack of understanding) however:
In the readme of the library there is the following state:

The resulting Laplacian is always a symmetric positive-definite matrix, with all positive edge weights.

But when i computed the mesh_laplacian from an .obj file (loaded with trimesh, example: dog8.obj.zip) and try to compute the eigenvalues using cholesky, I do get the following error:

import robust_laplacian
from sksparse.cholmod import cholesky

L, M = robust_laplacian.mesh_laplacian(np.array(mesh.vertices), np.array(mesh.faces))
chol = cholesky(L)

{CholmodNotPositiveDefiniteError}CholmodNotPositiveDefiniteError('/tmp/suite-sparse-20230122-5765-1n0vsg8/SuiteSparse-7.0.1/CHOLMOD/Supernodal/t_cholmod_super_numeric.c:963: matrix not positive definite (code 1)')

I'm able to fix the issue in that case by adding a a small epsilon to the laplacian

L.data += sys.float_info.epsilon
chol = cholesky(L)
op_inv = scipy.sparse.linalg.LinearOperator(matvec=chol, shape=L.shape, dtype=L.dtype)
eigen_values, eigen_vectors = scipy.sparse.linalg.eigsh(L, n_eig, M, sigma=0, OPinv=op_inv)

But due to my lack of understanding I'm note sure if this has any dire consequences.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions