Following this Julia Discourse thread:
mul! seems to be much slower than lmul!, rmul! and * in a dense QR factorisation:
Minimal example:
n, m = 500, 10
Q = qr(randn(n, m)).Q;
x = randn(n)
y = randn(n)
@time mul!(y, Q, x);
@time y = Q*x;
In the example above mul! runs in the order of seconds, while * in the order of microseconds.
Julia version: 1.0.1
macOS 10.14.2
I suspect mul! hits the generic fallback which would make it fascinatingly inefficient since getindex for Q has Θ(n²) complexity so the complete mul! computation is Θ(n⁵). Applying a compact Q matrix is really an in-place operation. We could hide that fact by adding a mul! method for Q matrices that just calls copy! and lmul!.
Hi, I was planning to contribute towards GSoC 2019. I want to contribute to this issue. Please give me some guidelines
Most helpful comment
I suspect
mul!hits the generic fallback which would make it fascinatingly inefficient sincegetindexforQhas Θ(n²) complexity so the completemul!computation is Θ(n⁵). Applying a compactQmatrix is really an in-place operation. We could hide that fact by adding amul!method forQmatrices that just callscopy!andlmul!.