def sort(X):
    """
    Return sorted elements of :param:`X` and array of corresponding
    sorted indices.

    :param X: Target vector.
    :type X: :class:`scipy.sparse` of format csr, csc, coo, bsr, dok, lil,
    dia or :class:`numpy.matrix`
    """
    assert 1 in X.shape, 'X should be vector.'
    X = X.flatten().tolist()[0]
    return sorted(X), sorted(list(range(len(X))), key=X.__getitem__)
