CSR/CSC: Provide constructor for unsorted but otherwise valid data
The main constructor from existing CSR/CSC data is e.g. try_from_csr_data. However, this deliberately rejects unsorted input. However, if the only issue with the data is that the column indices are not sorted, then this is fixable. We should provide a similarly named try_from_unsorted_csr_data which would sort the column indices when needed. Similarly for CscMatrix, as well as an analogous constructor for SparsityPattern.
Thanks to the work of @aarsenij in #1000, we now have an implementation for CSR matrices! :tada:
Besides an implementation for CSC matrices, there is some room for improvement in the current implementation. In particular, it always ends up allocating storage with the same size as the input because it computes a permutation for the whole value/index arrays. Instead, we could permute the column indices and values in a row at a time - in place using some local buffers. By first checking if the row is already sorted, we could ensure that we don't need any allocations in the case that the matrix already is properly sorted in the first place.
Furthermore, we end up traversing the matrix twice as we call ::try_from_csr_data with the resulting data to check the remaining invariants. To avoid this, we could instead create a method which would simultaneously check invariants and either return an error if the indices are not sorted, or optionally permute the indices if every other invariants is otherwise OK. Then the different try_ constructors could delegate to this method. This is a little bit complicated to implement in a way that is still reasonably maintainable, however.