3

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

Tyler Xie
  • 169
  • 1
  • 3
  • 13
  • I test another matlab code. After decomposition, the eigen values are the same except for the opposite sign. If I ignore `L = (-L).eval();` in above code, the two results are the same. – Tyler Xie Jun 22 '18 at 08:09
  • According to a paper, (sorry, I forget the name of that paper), the eigen values of the Laplace-Bletrami matrix should be greater or equal to zero. – Tyler Xie Jun 22 '18 at 08:11

1 Answers1

2

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).

Nico Schertler
  • 32,049
  • 4
  • 39
  • 70