Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cholmod: Laplacian matrix not positive definite #12

Open
rezss opened this issue Jul 2, 2023 · 0 comments
Open

Cholmod: Laplacian matrix not positive definite #12

rezss opened this issue Jul 2, 2023 · 0 comments

Comments

@rezss
Copy link

rezss commented Jul 2, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant