annotate tests/testLstsq.py @ 64:a115c982a0fd

Fixed bug in GAP: Lambdahat might get empty after row removing; in this case should stop and return current solution, otherwise it will raise an exception next time you try to remove rows
author Nic Cleju <nikcleju@gmail.com>
date Tue, 13 Mar 2012 16:18:11 +0200
parents 9079a9f7c4cf
children
rev   line source
nikcleju@7 1 import numpy as np
nikcleju@7 2 import numpy.linalg
nikcleju@7 3 import scipy.io
nikcleju@7 4 import scipy.linalg
nikcleju@7 5 import time
nikcleju@7 6
nikcleju@7 7 def main():
nikcleju@7 8 mdict = scipy.io.loadmat('testLstsq.mat')
nikcleju@7 9 A = mdict['A'].newbyteorder('=')
nikcleju@7 10 b = mdict['b']
nikcleju@7 11
nikcleju@7 12 starttime = time.time()
nikcleju@7 13 for i in np.arange(mdict['nruns']):
nikcleju@7 14 #for i in np.arange(100):
nikcleju@7 15 #np.linalg.lstsq(A, b)
nikcleju@7 16 np.linalg.svd(A)
nikcleju@7 17 print "Elapsed time = ",(time.time() - starttime)
nikcleju@7 18
nikcleju@7 19 if __name__ == "__main__":
nikcleju@7 20 main()