I am working on an eigenvalue problem in fortran. I used Lapack to solve the problem and get eigenvalues and eigenvectors. This is done for wave numbers 201x101, only half of the space due to symmetry and for each grid point in a large area (in the ocean). I am looking for the maximum eigenvalue for each grid point, and I would like not only to select the absolute maximum in the 201x101 matrix of eigenvalues, but to perform an azimuthal average value in the wave space, and then choose the maximum average value. I am afraid to see how to do it.
First I encoded it like this:
! Wavenumber domain
dx=4000.
pi = 4.*atan(1.)
DO m=1,ktot
kx(m) = -(2.*pi)/(dx) + ((m-1)*2.*pi)/(100.*dx)
END DO
DO l=1,ltot
ly(l)= ((l-1)*2.*pi)/(100.*dx)
END DO
Radial distanceDO m=1,ktot
DO l=1,ltot
raddist(m,l)=sqrt(kx(m)**2+ly(l)**2)
END DO
END DO
! ( - , , ktot * ltot)
DO i=1,ltot-1
ind=(raddist(:,i).GE.ly(i).AND.raddist(:,i).LT.ly(i+1))
length=count(ind)
WHERE (ind) average_omegai = sum(omegai)/length
END DO
, , k-, ly (i) ly (i + 1). , - . - ? !