apply @timholy's optimizations to sparse * to a couple other cases