index in one go. added sparse test.