# Svd accelerated with the MKL package, what about schur?

LinearAlgebra’s svd can be accelerated with the MKL package, what about schur? much slower than matlab
In order to avoid the unstable performance of matlab alone, and schur is iterating, it has a better effect on symmetric matrices. My research is mainly on symmetric matrices, so the test
First look at the matlab results:

Blockquote
a=rand(1000,1000);c=a*a’;
tic;for i=1:100 ;[q t]=schur(c) ;end;toc ---------2.5s
tic;for i=1:100 ;[u e v]=svd(c) ;end;toc ---------4.9s

In julia, to be similar to maltab, use @time:

Blockquote
using LinearAlgebra
a=rand(1000,1000);c=a*a’;
@time for i=1:100;q,t=schur(c);end
51.006555 seconds (8.23 k allocations: 1.519 GiB, 0.11% gc time, 0.01% compilation time)
@time for i=1:100;u,e,v=svd(c);end
39.062737 seconds (1.60 k allocations: 4.482 GiB, 0.19% gc time)
using MKL
#svd time ===matlab
@time for i=1:100;u,e,v=svd(c);end
5.043008 seconds (1.60 k allocations: 4.482 GiB, 2.47% gc time)
#but schur slower for matlab
@time for i=1:100;q,t=schur(c);end
20.999963 seconds (1.40 k allocations: 1.518 GiB, 0.35% gc time)

It can be seen that MKL does not improve schur. Is there a method similar to matlab for improving schur?

Looks like julia doesn’t check for symmetry, it probably should. Can you try schur(Symmetric(A))?

Thank you for your answer. This can indeed speed up a lot. It is indeed caused by this mechanism, but there should be other mechanisms. Compared with maltab, this speed worse than the svd time of maltab, but theoretically QR should It is much faster than svd, it should be at least 2 times, what judgment mechanism can speed it up?

The issue is that julia/schur.jl at master · JuliaLang/julia · GitHub doesn’t check symmetry. By comparison eigen does: julia/eigen.jl at master · JuliaLang/julia · GitHub so Someone ™ should probably make a PR that does this.

2 Likes