def testmtj(): from no.uib.cipr.matrix import Matrices, DenseMatrix, EVD, SVD t = time.time() mat = Matrices.random(500,500) x = EVD(500) x.factor(mat) #y = x.getRealEigenvalues() #print y print time.time()-t
def directlinearsolve(): from no.uib.cipr.matrix import Matrices, DenseMatrix, DenseVector from cern.colt.matrix import DoubleMatrix2D, DoubleFactory2D from cern.colt.matrix.linalg import Algebra sz = 1000 # MTJ x = DenseVector(sz) t = time.time() mat = Matrices.random(sz,sz) b = Matrices.random(sz) mat.solve(b,x) print "Mtj :" + str(time.time() - t) # Colt alg = Algebra() f = DoubleFactory2D.dense t = time.time() A = f.random(sz,sz) b = f.random(sz,1) x = alg.solve(A,b) print "Colt :" + str(time.time() - t)