Testing sparse and dense on the same matrix