Add non-zero-indices function

Does it need to be in one of the existing protocols?