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

make similar(A<:HermOrSym, opts...) consistently preserve A's storage type and uplo flag #24163

Merged
merged 1 commit into from
Oct 19, 2017

Conversation

Sacha0
Copy link
Member

@Sacha0 Sacha0 commented Oct 16, 2017

This pull request makes similar(A<:Union{Symmetric,Hermitian}, opts...) consistently preserve A's underlying storage type and uplo flag. For example, this pull request makes: (1) similar(Symmetric(sprand(4, 4, 0.5)), Float32, (3, 3)) yield a SparseMatrixCSC{Float32} rather than the present Matrix{Float32}; and (2) similar(Symmetric(rand(4, 4), :L)).uplo yield 'L' . Ref. #13731 (comment). Best!

@Sacha0 Sacha0 added the domain:linear algebra Linear algebra label Oct 16, 2017
@Sacha0 Sacha0 added this to the 1.0 milestone Oct 16, 2017
@fredrikekre
Copy link
Member

fredrikekre commented Oct 16, 2017

Fixes #19016 together with #24162 ?

@Sacha0
Copy link
Member Author

Sacha0 commented Oct 17, 2017

Thanks @fredrikekre! Absent objections or requests for time, I plan to merge these changes this evening or tomorrow morning. Best!

@@ -137,16 +137,17 @@ function setindex!(A::Hermitian, v, i::Integer, j::Integer)
end
end

similar(A::Symmetric, ::Type{T}) where {T} = Symmetric(similar(A.data, T))
# Hermitian version can be simplified when check for imaginary part of
Copy link
Member

Choose a reason for hiding this comment

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

Please keep some version of the comment

Copy link
Member Author

Choose a reason for hiding this comment

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

Comment restored :). Thanks!

@Sacha0 Sacha0 merged commit d9c04ad into JuliaLang:master Oct 19, 2017
@Sacha0 Sacha0 deleted the similarsym branch October 19, 2017 01:44
@Sacha0
Copy link
Member Author

Sacha0 commented Oct 19, 2017

Thanks all!

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

Successfully merging this pull request may close these issues.

3 participants