Collection of functions for matrix calculations