Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance issue of mul! in Q matrices from QR factorizations #31147

Closed
nrontsis opened this issue Feb 22, 2019 · 2 comments · Fixed by #31581
Closed

Performance issue of mul! in Q matrices from QR factorizations #31147

nrontsis opened this issue Feb 22, 2019 · 2 comments · Fixed by #31581
Labels
domain:linear algebra Linear algebra performance Must go faster

Comments

@nrontsis
Copy link
Contributor

nrontsis commented Feb 22, 2019

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

@andreasnoack andreasnoack added performance Must go faster domain:linear algebra Linear algebra labels Feb 22, 2019
@andreasnoack
Copy link
Member

andreasnoack commented Feb 22, 2019

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!.

@andreasnoack andreasnoack changed the title Performance issue of mul! in QRCompactWYQ Performance issue of mul! in Q matrices from QR factorizations Feb 25, 2019
@namanbiyani
Copy link

Hi, I was planning to contribute towards GSoC 2019. I want to contribute to this issue. Please give me some guidelines

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:linear algebra Linear algebra performance Must go faster
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants