Skip to contents

Convert negative indices to positive indices where negative indices are interpreted as indices counting from the back of the vector

Usage

toPositiveIndices(indices, n)

Arguments

indices

vector of integer indices

n

maximum index. The index -1 is mapped to n, the index -2 to n - 1, etc.