Add vector quantization function