Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


Math Forum » Discussions » Software » comp.soft-sys.matlab

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Andy Roach

Posts: 3
Registered: 12/7/04
Q: Vectorizing loop conditions
Posted: Aug 7, 1996 7:38 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic 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.





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.