Performs matrix multiplication using both traditional single threading and multithreading.