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
http://troutmask.apl.washington.edu/~kargl/



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
> http://troutmask.apl.washington.edu/~kargl/



Wed, 17 Dec 2008 04:20:46 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. a question about F90 intrinsic array function

2. Intrinsoc function as argument to intrinsic function question

3. Fortran 90 intrinsic array function?

4. using index- intrinsic function

5. Problem with AMOD intrinsic function using SGI f77 compilers

6. Internal compiler error when both using and passing an intrinsic function

7. GAWK: Question on using filefuncs.so (creating arrays in extension functions)

8. Stupid Intrinsic function question

9. Intrinsic function in PARAMETER question

10. Intrinsic Functions Question...

11. Error function intrinsic functions.

12. convert 2d array to 1d array without using shift registers and build array

 

 
Powered by phpBB® Forum Software