Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
7,444 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
module ArrayUtils | ||
implicit none | ||
|
||
contains | ||
|
||
function IndexOf(aval,arr, n) | ||
integer, intent(in) :: n, arr(n), aval | ||
integer IndexOf, i | ||
|
||
do i=1,n | ||
if (arr(i)==aval) then | ||
IndexOf= i | ||
return | ||
end if | ||
end do | ||
IndexOf = 0 | ||
|
||
end function IndexOf | ||
|
||
function MaxIndex(arr, n) | ||
integer, intent(in) :: n | ||
real, intent(in) :: arr(n) | ||
integer locs(1:1), MaxIndex | ||
|
||
locs = maxloc(arr(1:n)) | ||
MaxIndex = locs(1) | ||
|
||
end function MaxIndex | ||
|
||
|
||
function MinIndex(arr, n) | ||
integer, intent(in) :: n | ||
real, intent(in) :: arr(n) | ||
integer locs(1:1), MinIndex | ||
|
||
locs = minloc(arr(1:n)) | ||
MinIndex = locs(1) | ||
|
||
end function MinIndex | ||
|
||
end module ArrayUtils |
Oops, something went wrong.