WIP: linalg cleanups

This branch will track all the linalg work related to #2062.