Skip to content

Instantly share code, notes, and snippets.

@ryanrhymes
Last active July 5, 2017 00:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanrhymes/53b1235d4aacf198a8504426ed7ed2db to your computer and use it in GitHub Desktop.
Save ryanrhymes/53b1235d4aacf198a8504426ed7ed2db to your computer and use it in GitHub Desktop.
function f00()
x = rand(1000, 2000)
t0 = time()
LinAlg.LAPACK.gesvd!('A','A',x)
t1 = time()
@printf "time:\t\t%.8f\n" (t1 -t0)
end
function f00()
x = rand(4000, 4000)
t0 = time()
u, s, vt = LinAlg.svd(x)
t1 = time()
@printf "time:\t\t%.8f\n" (t1 -t0)
end
function f01()
x = rand(2000, 1000)
t0 = time()
Q, R = LinAlg.qr(x)
t1 = time()
@printf "time:\t\t%.8f\n" (t1 -t0)
end
(* for the following three, julia is faster *)
function f00()
x = rand(1000, 1000)
t0 = time()
LinAlg.LAPACK.geevx!('B','V','V','B',x)
t1 = time()
@printf "time:\t\t%.8f\n" (t1 -t0)
end
function f01()
x = rand(1000, 1000)
t0 = time()
LinAlg.eigvals(x)
t1 = time()
@printf "time:\t\t%.8f\n" (t1 -t0)
end
function f02()
x = rand(1000, 1000)
t0 = time()
LinAlg.LAPACK.geevx!('B','N','N','N',x)
t1 = time()
@printf "time:\t\t%.8f\n" (t1 -t0)
end
function f03()
x = rand(2000, 2000)
t0 = time()
v, w = LinAlg.eig(x)
t1 = time()
@printf "time:\t\t%.8f\n" (t1 -t0)
end
function f04()
x = rand(4000, 4000)
t0 = time()
v = cov(x)
t1 = time()
@printf "time:\t\t%.8f\n" (t1 -t0)
end
function f05()
x = rand(4000, 4000)
t0 = time()
v = cumsum(x,2)
t1 = time()
@printf "time:\t\t%.8f\n" (t1 -t0)
end
function f05()
x = rand(4000, 4000)
t0 = time()
v = sum(x,1)
t1 = time()
@printf "time:\t\t%.8f\n" (t1 -t0)
end
function f06()
x = rand(4000, 4000)
t0 = time()
v = sin(x)
t1 = time()
@printf "time:\t\t%.8f\n" (t1 -t0)
end
(* ocaml code *)
Mat.(p *@ q =~ x);;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment