Finished figure 5 code. Fixed floating point equality bug in getVM and getWeights...