Re: How to select a subset of an array in Fortran 90
- From: Michel OLAGNON <molagnon@xxxxxxxxxxxxxxxxx>
- Date: Thu, 30 Jun 2005 16:18:24 +0200
Leonard W. Howell, Jr. wrote:
I'm trying to do the following but w/o any success:
I need a subroutine - call it SELECT - this is passed an array A, say of dimension N, and I would like SELECT to return an array B of dimension M<=N where B is a subset of A constructed according to some criteria. For example, I might have
SUBROUTINE SELECT(A,N, RANGE, B, M)
and B could be the elements of A between Range(1) and Range(2).
I thought I could define B like
WHERE (A<=Range(2).AND.A >= Range(1)) B=A Endwhere
I am having trouble with the variable dimension of B in the subroutine so any help would be appreciated, Leonard
B = PACK (A, Mask=(A<=Range(2).AND.A >= Range(1))) M = COUNT (A<=Range(2).AND.A >= Range(1))
.... and pray that your optimizing compiler is smart enough to detect the repetition.
.
- Follow-Ups:
- Re: How to select a subset of an array in Fortran 90
- From: Levent
- Re: How to select a subset of an array in Fortran 90
- References:
- How to select a subset of an array in Fortran 90
- From: Leonard W. Howell, Jr.
- How to select a subset of an array in Fortran 90
- Prev by Date: Re: backslash-issues
- Next by Date: HELP ME, please
- Previous by thread: How to select a subset of an array in Fortran 90
- Next by thread: Re: How to select a subset of an array in Fortran 90
- Index(es):
Relevant Pages
|