ENH: allow 0-by-0 in linalg.inv and linalg.solve

Allows 0-by-0 matrix in linalg.inv and linalg.solve. The inverse of the 0-by-0
matrix is again the 0-by-0 inverse. Closes #3291.