Array subsetting
- From: L.Spadavecchia@xxxxxxxxxxxxxx
- Date: 31 Aug 2006 03:25:58 -0700
Hello all,
I am running into difficulties using the WHERE function to subset
arrays. I am currently writing a program which needs to apply a
threshold to a real array of dimension (nx,ny). Lets call this array1.
I then have a second real array - lets call that array2- (I understand
all the arrays in the where statement must be of the same type?) which
will store the result as a binary value. It too has dimension (nx,ny).
Heres the way it appears in the program.
INTEGER,PARAMETER :: nx,ny
REAL :: threshold
REAL,DIMENSION(:,:),ALLOCATABLE :: array1,array2
ALLOCATE(array1(nx,ny))
ALLOCATE(array2(nx,ny))
WHERE (array1 > threshold)
array2 = 1.0
ELSE WHERE
array2 = 0.0
END WHERE
On trying to run this, I always get a stack overflow. I can't figure it
out, because the arrays are of the same rank, size and type. It may be
important that array1 actually sits in a global data module, whereas
array2 is local to the subroutine which thresholds the data.
Any help would be greatly appreciated.
Luke
.
- Follow-Ups:
- Re: Array subsetting
- From: Richard E Maine
- Re: Array subsetting
- From: David Frank
- Re: Array subsetting
- From: Michel Olagnon
- Re: Array subsetting
- Prev by Date: Parallel communication - SHMEM / ARMCI
- Next by Date: Array puzzle
- Previous by thread: Parallel communication - SHMEM / ARMCI
- Next by thread: Re: Array subsetting
- Index(es):
Relevant Pages
|