question about using array intrinsic functions
Author Message
question about using array intrinsic functions

HI,
I have an array a(i), i=1,3
I also have another array b(j,i), j=1,5, i=1,3
If I would like to compare the each element of a(i) with b(j,i), j=1,5.
For example
If i can find one set of b(j,i) from j=1, 5 that all corresponding
element of a(i) is less than b(j,i)
then I would like to do something further.

Then How can I use the "all " funciton in this case? Because the a and
b are not in the same dimension.
Thank you very much.

Wed, 17 Dec 2008 03:47:41 GMT
question about using array intrinsic functions

Quote:
> HI,
> I have an array a(i), i=1,3
> I also have another array b(j,i), j=1,5, i=1,3
> If I would like to compare the each element of a(i) with b(j,i), j=1,5.
> For example
> If i can find one set of b(j,i) from j=1, 5 that all corresponding
> element of a(i) is less than b(j,i)
> then I would like to do something further.

> Then How can I use the "all " funciton in this case? Because the a and
> b are not in the same dimension.
> Thank you very much.

Do you mean something like this

program g
integer j, b(5,3), a(3)
a = (/2, 2, 3/)
b = 10
b(1,:) = 1
b(2,:) = 2
b(3,:) = 3
do j = 1, 5
if (all(b(j,:) < a)) then
print *, j
end if
end do
end program g

--
Steve

Wed, 17 Dec 2008 03:59:49 GMT
question about using array intrinsic functions
Yes, things like this:
if (all(b(j,:) < a)) then
Now I know what to do !
Thank you very much!!
Quote:

> > HI,
> > I have an array a(i), i=1,3
> > I also have another array b(j,i), j=1,5, i=1,3
> > If I would like to compare the each element of a(i) with b(j,i), j=1,5.
> > For example
> > If i can find one set of b(j,i) from j=1, 5 that all corresponding
> > element of a(i) is less than b(j,i)
> > then I would like to do something further.

> > Then How can I use the "all " funciton in this case? Because the a and
> > b are not in the same dimension.
> > Thank you very much.

> Do you mean something like this

> program g
>   integer j, b(5,3), a(3)
>   a = (/2, 2, 3/)
>   b = 10
>   b(1,:) = 1
>   b(2,:) = 2
>   b(3,:) = 3
>   do j = 1, 5
>      if (all(b(j,:) < a)) then
>         print *, j
>      end if
>   end do
> end program g

> --
> Steve