view tests/testLstsq.py @ 18:a8ff9a881d2f

GAP test almost working. For some data the results are not the same because of representation error, so the test doesn't fully work for now. But the results seem to be accurate.
author nikcleju
date Mon, 07 Nov 2011 17:48:05 +0000
parents 9079a9f7c4cf
children
line wrap: on
line source
import numpy as np
import numpy.linalg
import scipy.io
import scipy.linalg
import time

def main():
	mdict = scipy.io.loadmat('testLstsq.mat')
	A = mdict['A'].newbyteorder('=')
	b = mdict['b']
	
	starttime = time.time()
	for i in np.arange(mdict['nruns']):
	#for i in np.arange(100):
		#np.linalg.lstsq(A, b)
		np.linalg.svd(A)
	print "Elapsed time = ",(time.time() - starttime)

if __name__ == "__main__":
	main()