Implementation of the Linde-Buzo-Gray or LBG algorithm