sparsemat / sprs

sparse linear algebra library for rust
Apache License 2.0
381 stars 45 forks source link

Be able to recover the input type on errors when creating matrices #255

Closed vbarrielle closed 3 years ago

vbarrielle commented 3 years ago

Right now, when creating types with structure constraints (IndPtrBase, CsMatBase, CsVecBase) from owned data, the owned data is lost if the check fails, which can be incovenient for the caller.

A possible solution is to have SprsError be more than an enum, and parameterized on a type, so that it can store the input type in these cases.

I don't know how it will turn out for composability or performance though. Maybe it will be required to box the value, and maybe also to erase its type with Any to preserve composability.

This will need a bit of experimentation.