Efficient implementation of The Boltzmann Machine Algorithm