Optional index arrays for sort-smallest-index, sort-largest-index
Arguments simplified in sort-smallest-index, sort-largest-index; output array is optional and may be specified by size. Docstrings made accurate. Previous versions selected only the first n part of the unsorted array. Other functions in this file could benefit from similar changes, but the changes have not been made because of the existence of tests.