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

reduce allocation in inv(A::StridedMatrix) where A istriu or istril #24133

Merged
merged 1 commit into from
Oct 14, 2017

Conversation

Sacha0
Copy link
Member

@Sacha0 Sacha0 commented Oct 13, 2017

A small optimization. What say you, CI? Best!

@Sacha0 Sacha0 added domain:linear algebra Linear algebra performance Must go faster labels Oct 13, 2017
@andreasnoack andreasnoack merged commit 7c4918f into JuliaLang:master Oct 14, 2017
@@ -673,11 +673,9 @@ function inv(A::StridedMatrix{T}) where T
S = typeof((one(T)*zero(T) + one(T)*zero(T))/one(T))
AA = convert(AbstractArray{S}, A)
if istriu(AA)
Ai = inv(UpperTriangular(AA))
Ai = convert(typeof(parent(Ai)), Ai)
Ai = triu!(parent(inv(UpperTriangular(AA))))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could have used full! here. As mentioned in #24137 (comment), it would be better to use a generic function for this operation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Full response in the other thread :).

@Sacha0 Sacha0 deleted the lighterinv branch October 14, 2017 17:57
@Sacha0
Copy link
Member Author

Sacha0 commented Oct 14, 2017

Thanks Andreas!

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 this pull request may close these issues.

2 participants