Library for matrix multiplication with optional pipelining