BUG: sparse/dsolve: check sparse matrix inputs more carefully