hello,
question:
is there an implicit way to use ranges to select a subarray of nearest
nieghbors? AND have a wrap-a-round condition? Like for a 2Dimensional
20X20 array of one of 0,0 neighbors would be 20,20 using periodic boundary
conditions.
explanation/elaboration:
i normally just use a type c macro like so:
const int LENGTH_X = 20;
#define i_plus ( ( i + 1 ) % LENGTH_X )
which works ok, but still requires element by element access to the
client.
as an aside i tried using an inline function:
inline int i_plus (int a) { return ( ( a + 1 ) % LENGTH_X ); }
but got lots of compile error which seemed to be associated with blitz, so
went back to the macro.
the code went something like this:
Array<int,2> spin(LENGTH_X,LENGTH_Y);
int i,j,S;
for( i=0; i < LENGTH_X ; i++ )
for( j=0; j < LENGTH_Y ; j++ )
S =spin(i_plus,j) + spin(i_minus,j) + spin(i,j_minus) +spin(i,j_plus);
i would like it to be something like this:
S = sum (
spin( Range(i_plus,i_minus), Range(j_plus,j_minus) )
);
any suggestions?
thank you very much,
chris
charwel@chthry.chem.lsu.edu
--------------------- blitz-support list --------------------------------
* To subscribe/unsubscribe: mail to majordomo@oonumerics.org, with
"subscribe blitz-support" or "unsubscribe blitz-support" in the body of the message
* Blitz++ web page: http://oonumerics.org/blitz/
This archive was generated by hypermail 2b29 : Wed Feb 20 2002 - 05:10:05 EST