Discussion of Jacobi's method for eigenvalues

Finding the max nondiagonal element

//  the offdiag function, using Armadillo
void offdiag(mat A, int *p, int *q, int n);
{
   double max;
   for (int i = 0; i < n; ++i)
   {
       for ( int j = i+1; j < n; ++j)
       {
           double aij = fabs(A(i,j));
           if ( aij > max)
           { 
              max = aij;  p = i; q = j;
           }
       }
   }
}
// more statements