Fix in methods 'reinterpret' and 'reshape' for sparse matrices.

Calling these methods on sparse matrices would result in corruption
of the original matrix, due to an accidental sharing of the 'rowval'
field.  This is now prevented by copying the field.
Changed `copy` to `similar` of previous fix, and added test case.
Changed `reshape` of a sparse matrix

Nonzero elements now copied rather than shared, to prevent
accidental corruption when inserting new elements.
Added a lacking `copy` command to proposed test case.
Merge pull request #7677 from Oddan/sparse-fix

RFC: Fix in methods `reinterpret` and `reshape` for sparse matrices.