sample code from http://gforge.se/2013/04/using-the-svd-to-find-the-needle-in-the-haystack/