Name: arraylib::IndexWrap - project a cyclic index value onto interval [0,N).

Synopsis:

index N CyclicValue -&gt; normindex


Examples:

-6 3 IndexWrap   -&gt; 0 
-5 3 IndexWrap   -&gt; 1 
-4 3 IndexWrap   -&gt; 2 
-3 3 IndexWrap   -&gt; 0 
-2 3 IndexWrap   -&gt; 1 
-1 3 IndexWrap   -&gt; 2 
0 3 IndexWrap   -&gt; 0 
1 3 IndexWrap   -&gt; 1 
2 3 IndexWrap   -&gt; 2 
3 3 IndexWrap   -&gt; 0 
4 3 IndexWrap   -&gt; 1 
5 3 IndexWrap   -&gt; 2 
6 3 IndexWrap   -&gt; 0


Description:

"IndexWrap" projects a cyclic integer index in the range (-oo,oo), 
of periodicy N, onto its norm interval [0,N). 
This function can be used to "wrap around" array indices in order to 
index an array 
Alternatives: Function IndexWrap_i_i (undocumented) -&gt; behaviour and 
synopsis are the same, except that no warnings or error messages are 
thrown.


Parameters:

In : index: integer value in (-oo,oo). 
N: Peroidicity of the cyclic index. 
"index" is projected on the half-open interval [0,N). 
N must be positive (and different from 0). 
Out: The cyclic equivalent of the given index, regarding period N.


Diagnostics:

N must be positive (and different from 0). If N &lt;= 0, /RangeCheck is raised. 
Note that the variant IndexWrap_i_i does not do this check for 
efficiency, and will break or yield invalid results in this case.


Remarks:

This function behaves like Mathematica's Mod function (which is 
different from the mathematical definition of MOD).


Availability:

"Namespace"-dictionary "arraylib".


Author:

Ruediger Kupper


FirstVersion:

14.2.2003 (Einstein's birthday)


SeeAlso:

arraylib::EdgeWrap
mod
CyclicValue

Source:

/var/www/debian/nest/nest-simulator-2.20.0/lib/sli/arraylib.sli
