working matrix multiplication with configurable params