added functions to nearestDSmax_RE.cu