# Command: arraylib::IndexWrap

NEST HelpDesk | Command Index | NEST Quick Reference

Name:

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

      Synopsis:  index N CyclicValue -> normindex

Examples:

      -6 3 IndexWrap   -> 0
      -5 3 IndexWrap   -> 1
      -4 3 IndexWrap   -> 2
      -3 3 IndexWrap   -> 0
      -2 3 IndexWrap   -> 1
      -1 3 IndexWrap   -> 2
      0 3 IndexWrap   -> 0
      1 3 IndexWrap   -> 1
      2 3 IndexWrap   -> 2
      3 3 IndexWrap   -> 0
      4 3 IndexWrap   -> 1
      5 3 IndexWrap   -> 2
      6 3 IndexWrap   -> 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) -> 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 <= 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:

    /opt/conda/conda-bld/nest_1512418852064/work/nest-2.12.0/lib/sli/arraylib.sli

NEST HelpDesk | Command Index | NEST Quick Reference

© 2004 The NEST Initiative