Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Q: Vectorizing loop conditions
Replies: 1   Last Post: Aug 9, 1996 9:17 AM

 Search Thread: Advanced Search

 Messages: [ Previous | Next ]
 Andy Roach Posts: 3 Registered: 12/7/04
Q: Vectorizing loop conditions
Posted: Aug 7, 1996 7:38 PM
 Plain Text Reply

I am trying to vectorize some old Fortran code and have run into
a problem. In the finite difference grid, the code checks that it
hasn't run into boundaries and so, depending on the component being
computed, it tests whether (bth(i,j)>0 & bth(i+1,j)>0) or
(bth(i,j)>0 & bth(i,j+1)>0).

I have settled on making a mask of valid bth locations with
bthz(2:in,2:jn)=~(bth(2:in,2:jn)<0 & bth(3:ie,2:jn)<0) for
example. That makes a zero mask that I then multiply by the
terms of the equation. Not very elegant, but it works in a crude
way. It calculates the edge terms (near the boundaries) which
I don't want to do.

Any ideas on vectorizing the conditional bth test(s) so that the
subsequent vectorized loop runs efficiently?

Thanks in advance.

Date Subject Author
8/7/96 Andy Roach
8/9/96 Joe Deasy

© The Math Forum at NCTM 1994-2018. All Rights Reserved.