Some useful matrix operations.