~yade-dev/yade/eigen3

« back to all changes in this revision

Viewing changes to Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h

  • Committer: Anton Gladky
  • Date: 2012-11-07 22:02:48 UTC
  • Revision ID: gladky.anton@gmail.com-20121107220248-uoks7euvfwp7wrf7
3.1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
743
743
//   RealScalar e2 = abs2(subdiag[end-1]);
744
744
//   RealScalar mu = diag[end] - e2 / (td + (td>0 ? 1 : -1) * sqrt(td*td + e2));
745
745
  // This explain the following, somewhat more complicated, version:
746
 
  RealScalar mu = diag[end] - (e / (td + (td>0 ? 1 : -1))) * (e / hypot(td,e));
 
746
  RealScalar mu = diag[end];
 
747
  if(td==0)
 
748
    mu -= abs(e);
 
749
  else
 
750
  {
 
751
    RealScalar e2 = abs2(subdiag[end-1]);
 
752
    RealScalar h = hypot(td,e);
 
753
    if(e2==0)  mu -= (e / (td + (td>0 ? 1 : -1))) * (e / h);
 
754
    else       mu -= e2 / (td + (td>0 ? h : -h));
 
755
  }
747
756
  
748
757
  RealScalar x = diag[start] - mu;
749
758
  RealScalar z = subdiag[start];