about summary refs log tree commit diff
path: root/sourcecodes/bnt-master/KPMtools/wrap.m
blob: 9a5f2a2a31659e9411084e124751a2a3e048e0b5 (plain)
1
2
3
4
5
6
7
function v = wrap(u,N)
% WRAP Wrap a vector of indices around a torus.
% v = wrap(u,N)
%
% e.g., wrap([-1 0 1 2 3 4], 3)   =   2 3 1 2 3 1

v = mod(u-1,N)+1;