compute indices