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

Specialize A * Eye and Eye * A #168

Closed
cossio opened this issue Jan 4, 2022 · 3 comments
Closed

Specialize A * Eye and Eye * A #168

cossio opened this issue Jan 4, 2022 · 3 comments

Comments

@cossio
Copy link

cossio commented Jan 4, 2022

d = Diagonal(Ones(10))

The following ops fallback to generic (diagonal) matrix multiplies.

d * randn(10, 10)
randn(10, 10) * d

A faster fallback is possible since d is just the identity matrix.

@dlfivefifty
Copy link
Member

@cossio
Copy link
Author

cossio commented Jan 5, 2022

How's that faster than just returning the other term?

d = Diagonal(Ones(10))
A = randn(10,10)
d * A # should just return A

@dlfivefifty
Copy link
Member

No it should return a copy of A, which broadcasting with Ones should do.

though I noticed there’s been changes to diagonal multiple so it’s possible that things are no longer as fast. But adding an override for this will need to be a new minor version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants