Restrict inv to dense matrices to have a better error for #4439