title: Generalized eigenvalue for two matrices in OpenCV
body: <p>Hello I am working on a project involving in face recognition for which I am using Linear Discriminant Analysis(LDA). LDA demands to find the generalized eigen vectors for the between class scatter matrix and with in class scatter matrix and that is where I am struck. I am using opencv with DevC++ for coding. Basically the problem looks like </p>
  
  <pre><code>A*v=lambda*B*v
  </code></pre>
  
  <p>where A and B are matrices for which generalized eigen vectors should be found
        lambda is eigen values and v is vectors</p>
  
  <p>Upon searching about this problem many people suggested to go for calculating the inverse of B and then multiplying with A*v </p>
  
  <pre><code>(inv(B)*A)*v=lambda*v 
  </code></pre>
  
  <p>and then calculate eigen vectors for inv(B)*A.</p>
  
  <p>It seems to be a good solution but in my case the scatter matrix B is almost sigular. I found its determinant is in the order of 10^-36 .So I cant find its inverse and proceed with the above solution. So Can some one suggest me a way to get out of this problem except saying to code for generalized eigen value problem separately. </p>