Fortran-location
提供:Dev Guides
Fortran-ロケーション関数
次の表で、ロケーション関数について説明します。
Function | Description |
---|---|
maxloc(array, mask) | It returns the position of the greatest element in the array array, if mask is included only for those which fulfil the conditions in mask, position is returned and the result is an integer vector. |
minloc(array, mask) | It returns the position of the smallest element in the array array, if mask is included only for those which fulfil the conditions in mask, position is returned and the result is an integer vector. |
- 例 *
次の例は、概念を示しています。
program arrayLocation
implicit none
real, dimension(1:6) :: a = (/21.0, 12.0,33.0, 24.0, 15.0, 16.0/)
Print* , maxloc(a)
Print *, minloc(a)
end program arrayLocation
上記のコードをコンパイルして実行すると、次の結果が生成されます。
3
2