* CSC: Create constructor for unsorted but otherwise valid data
* Test creating csc matrix from unsorted but valid data
* Add function for validation and sorting
* Move validation function to cs.rs
* Restore pattern unit test
* Add unit test for 'major offset out of bounds' case
* Avoid permutation allocations on 'happy path'
* Reuse allocated permutation
* Fix comments for test-data examples
* Remove unnecessary iter variable
* Set up buffers for sorting up front
* Use common apply_permutation function
* Use common compute_sort_permutation function
* Move unsafe down to unchecked call
* Add panic cases to documentation
* Remove unnecessary Zero bound
* Move buffer set up away from loop
* Lift T::Zero from cs.rs
* Improve checking if values are provided
* Simplify copying from slices & add test for wrong values length
* Check duplicates after sorting
* Fix formatting
* Check values length at the beginning
* Check length of values if values != None
This mimics how std does it, e.g. std::vec::Vec. This avoids potential
problems down the road, where adding more types might clutter the
API interface and generated documentation.
SparsityPattern's constructor now returns a fine-grained error
enum that enumerates possible errors. We use this to build a more
user-friendly error when constructing CSR matrices.
We also overhauled the main SparseFormatError error type by
making it a struct containing a *Kind type and an underlying error
that contains the message.
We can easily create the CSR and CSC constructors by using the
SparsityPattern constructors. However, one lingering problem
is giving meaningful error messages. When forwarding error messages
from the SparsityPattern constructor, the error messages must
be written in terms of "major" or "minor" dimensions, and using
general terms like "lanes", instead of "rows" and "columns".
When forwarding these messages up to CSR or CSC constructors,
they are not directly meaningful to an end user. We should find
a better solution to this problem, so that end users get
more meaningful messages.