比较了几种软件创建和运算(加法和乘法)稀疏矩阵的速度。 clear | clear tic | n=200; n = 200; | tic() A = rand(n,n); | A=rand(n,n); for i=1:1000 | for i=1:1000 A = A + rand(n,n) * rand(n,n); | A=A+rand(n,n)*rand(n,n); end | end toc | ha=toc() Elapsed time Octave 12.35s Matlab 3.77s scilab 2.641s import os import numpy as np import scipy as sp import matplotlib as mpl import matplotlib.pyplot as plt import timeit from scipy import random n = 200; a1=os.times() A = random.rand(n,n); for i in range(1,1001): A = A + random.rand(n,n) * random.rand(n,n); a2=os.times() c=a2[0]-a1[0] print c python 2.32s 结果表明,python的运算速度还是可以的,可惜的是没有运算特征值的函数。 |
GMT+8, 2024-11-24 18:44 , Processed in 0.033305 second(s), 15 queries , Gzip On.
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.