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

Use similar+copy! instead of copy_oftype for AbstractMatrix #16288

Merged
merged 2 commits into from
May 11, 2016

Conversation

andreasnoack
Copy link
Member

Throw error for LowerTriangular(::UpperTriagular) and vice versa to avoid infinite compilation recursion.

Use similar+copy! instead of copy_oftype for AbstractMatrix arguments to make sure that the copy is mutable. Fixes JuliaLang/LinearAlgebra.jl#316

This also kind of fixes #16201 since it doesn't hang anymore.

@@ -39,6 +39,9 @@ for t in (:LowerTriangular, :UnitLowerTriangular, :UpperTriangular,
end
end

LowerTriangular(U::UpperTriangular) = throw(ArgumentError("this shouldn't happen. Please submit a bug report"))
UpperTriangular(U::LowerTriangular) = throw(ArgumentError("this shouldn't happen. Please submit a bug report"))
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is quite right, a user could easily call the constructors to try to do this. Maybe something like "Cannot create an UpperTriangular matrix from a LowerTriangular input"?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. That is probably better. I'll update the error message.

to make sure that copy is mutable. Fixes #15401
@andreasnoack andreasnoack merged commit 81584a5 into master May 11, 2016
@andreasnoack andreasnoack deleted the anj/mutablecopy branch May 11, 2016 19:54
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

Successfully merging this pull request may close these issues.

a \ b::Diagonal throws an error Infinitely growing compilation recursion
2 participants