c++geometrycomputational-geometrylibigl

Libigl - Laplace Bletrami Operator Decomposition


The following code is from Libigl's tutorial 306 : http://libigl.github.io/libigl/tutorial/#eigen-decomposition

  ........
  SparseMatrix<double> L,M;
  cotmatrix(V,F,L);
  L = (-L).eval();     // WHY?????
  massmatrix(V,F,MASSMATRIX_TYPE_DEFAULT,M);
  const size_t k = 5;
  if(!eigs(L,M,k+1,EIGS_TYPE_SM,U,D))
  {
    cout<<"failed."<<endl;
  }
  // Normalize
  U = ((U.array()-U.minCoeff())/(U.maxCoeff()-U.minCoeff())).eval();
  .......

I do not understand L = (-L).eval(); Can anyone help me? The complete code can be found at https://github.com/libigl/libigl/blob/master/tutorial/306_EigenDecomposition/main.cpp


Solution

  • Different people use different conventions for the Laplacian. libigl produces a negative semi-definite Laplacian (see documentation notes). Hence, this matrix has non-positive eigenvalues. On the other hand, libigl::eigs() requires a positive semi-definite matrix. That's why L is negated (to turn the negative semi-definite matrix into a positive semi-definite one).