00001 00002 c 00003 c Copyright (c) 1986,1987,1988,1989,1990,1991,1992,1993, 00004 c by Steve McMillan, Drexel University, Philadelphia, PA. 00005 c 00006 c All rights reserved. 00007 c 00008 c Redistribution and use in source and binary forms are permitted 00009 c provided that the above copyright notice and this paragraph are 00010 c duplicated in all such forms and that any documentation, 00011 c advertising materials, and other materials related to such 00012 c distribution and use acknowledge that the software was developed 00013 c by the author named above. 00014 c 00015 c THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 00016 c IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 00017 c WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00018 c 00019 00020 00021 subroutine minmax(a,n,amin,amax) 00022 save 00023 dimension a(1) 00024 c 00025 amin = 1.e30 00026 amax = -1.e30 00027 call minmax1(a,n,amin,amax) 00028 c 00029 end 00030 00031 00032 subroutine minmax1(a,n,amin,amax) 00033 save 00034 c 00035 c Like minmax, but use the input amin, amax as initial values. 00036 c 00037 dimension a(1) 00038 c 00039 do 100 i=1,n 00040 amin = min(amin,a(i)) 00041 amax = max(amax,a(i)) 00042 100 continue 00043 c 00044 end 00045 00046 00047 subroutine iminmax(a,n,imin,imax) 00048 save 00049 c 00050 c Like minmax, but return the locations of the minimum and the maximum. 00051 c 00052 dimension a(1) 00053 c 00054 imin = 0 00055 imax = 0 00056 amin=1.e30 00057 amax=-1.e30 00058 do 100 i=1,n 00059 if (a(i).lt.amin) then 00060 amin = a(i) 00061 imin = i 00062 end if 00063 if (a(i).gt.amax) then 00064 amax = a(i) 00065 imax = i 00066 end if 00067 100 continue 00068 c 00069 end