They have more structure than just being sparse. The values are only 0,1,2, so we could just keep an array of size 3 and increment dot-product quantities corresponding to each value (nothing needs to be done when 0). Then multiply one time later like a[1] + 2 * a[2] as the full dot-product.
They have more structure than just being sparse. The values are only 0,1,2, so we could just keep an array of size 3 and increment dot-product quantities corresponding to each value (nothing needs to be done when 0). Then multiply one time later like a[1] + 2 * a[2] as the full dot-product.