Cleanup: moved some functions to linear_algebra.h, made more intuitive interfaces, added some operators