add sparse implementation