CPU algorithm uses separate matrix for input and output