! Find the maximum element location in array
function maxindex(v)
use work

complex v(n)

maxindex =1

v_max =maxval(abs(v))

do i=1,n
if(abs(v(i)) ==v_max) then
maxindex =i
exit
endif
enddo

END
