Skip to content

Remove hacks for 6721 for typealias in symmetric.jl #21565

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

Merged
merged 4 commits into from
Apr 28, 2017
Merged

Conversation

musm
Copy link
Contributor

@musm musm commented Apr 26, 2017

No description provided.

HermOrSym{T,S} = Union{Hermitian{T,S}, Symmetric{T,S}}
RealHermSymComplexHerm{T<:Real,S} = Union{Hermitian{T,S}, Symmetric{T,S}, Hermitian{Complex{T},S}}
const HermOrSym{T,S} = Union{Hermitian{T,S}, Symmetric{T,S}}
const RealHermSymComplexHerm{T<:Real,S} = Union{Hermitian{T,S}, Symmetric{T,S}, Hermitian{Complex{T},S}}
Copy link
Member

Choose a reason for hiding this comment

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

these consts aren't necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know, but it's a lot easier to quickly glance a file and figure out it's a typealias with the const there

Copy link
Contributor Author

@musm musm Apr 26, 2017

Choose a reason for hiding this comment

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

This can also be written

const RealHermSymComplexHerm{T,S} = Union{Hermitian{T,S}, Symmetric{T,S}, Hermitian{Complex{T},S}} where T<:Real

perhaps that is more clear ? as the right hand side matches something you would find in a function signature.

Copy link
Member

@StefanKarpinski StefanKarpinski left a comment

Choose a reason for hiding this comment

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

This code seems pretty repetitive – could the repetition be factored out?

@musm
Copy link
Contributor Author

musm commented Apr 26, 2017

This code seems pretty repetitive – could the repetition be factored out?

Probably but for a different PR.

eigfact!(S != T ? convert(AbstractMatrix{S}, A) : copy(A))
end

eigfact!(A::RealHermSymComplexHerm, irange::UnitRange) = Eigen(LAPACK.syevr!('V', 'I', A.uplo, A.data, 0.0, 0.0, irange.start, irange.stop, -1.0)...)
Copy link
Member

@Sacha0 Sacha0 Apr 26, 2017

Choose a reason for hiding this comment

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

The <:StridedMatrix constraint seems necessary given the implementation via LAPACK? (Edit: Similarly, shouldn't the element type be constrained to BlasFloats?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes!

Copy link
Member

@Sacha0 Sacha0 left a comment

Choose a reason for hiding this comment

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

Thanks @musm! :)

@kshyatt kshyatt added linear algebra Linear algebra types and dispatch Types, subtyping and method dispatch labels Apr 26, 2017
@Sacha0
Copy link
Member

Sacha0 commented Apr 27, 2017

(Absent objections, requests for time, or someone else beating me to it, I plan to merge this pull request this evening or tomorrow morning. Best!)

@tkelman tkelman merged commit 3f20d80 into JuliaLang:master Apr 28, 2017
@musm musm deleted the 67f branch April 28, 2017 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linear algebra Linear algebra types and dispatch Types, subtyping and method dispatch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants