integer, parameter :: m=100, n=200
real :: x(m), y(n), z(m,n),loc(2)
integer :: i, j
do i=1,m
do j=1,n
z(i,j)=x(i)+y(j)
enddo
enddo
loc=maxloc(z)
write(*,*) "peaking at ", x(loc(1)), y(loc(2))
Is it possible to avoid using the temporary array loc(2)? In other words, is there a method of directly accessing the result of maxloc in the above case, e.g., x(maxloc(z)(1))
?