fixed bug in mds.py

this error is raised in OSX 10.9 with float64: use np.allclose, make code cleaner and less buggy