Why are we casting all input arrays into COO matrices? Surely dense matrices should be kept as dense?