view tests/testLstsq.py @ 67:a8d96e67717e

Added the Analysis-By-Synthesis algorithms used in the papers "Analysis-based sparse reconstruction with synthesis-based solvers", "Choosing Analysis or Synthesis Recovery for Sparse Reconstruction" and "A generalization of synthesis and analysis sparsity"
author Nic Cleju <nikcleju@gmail.com>
date Tue, 09 Jul 2013 14:21:10 +0300
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()