PERF: Minimize copy of vectors in linalg operations.

By maximizing the const and reference usage, there will be
less unnecessary copy constructions occuring with temporary
variables.