ENH: linalg: make use of type calc in inv/solve

Fix result type handling in inv/solve as suggested in discussion of #3293.