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
Add missing constructors for Bidiagonal
, Symmetric
, and Hermitian
#42467
Conversation
c260352
to
e373ef0
Compare
Failures look unrelated. |
julia> f(a,b::Int = 1) = 1
f (generic function with 2 methods)
julia> f(a,b::Float64) = 2
f (generic function with 3 methods)
julia> f(1,1), f(1), f(1,1.0)
(1, 1, 2) I think you only need to add the new constructor? |
Done. Actually, this and
This is done in #42466. I will add a note not to submit this one until that is merged.
Doing it this way causes a Method Overwriting warning during compilation (doesn't happen in the REPL I guess, but it happens when running
It's missing in the sense that some of the constructors allow Thanks for the comments. |
Note that this should be submitted after #42466, so that the correct |
You can rebase onto current master now. |
# suppress method overwritten warning while preserving | ||
# the historical default argument `uplo=:U` | ||
Hermitian(A::AbstractMatrix) = Hermitian(A, :U) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a new issue or has it always been there but we ignored the warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is new if we add another method with a different default parameter type. The warning was not there before because there was only one Hermatian
function with a default type parameter.
I'm not sure, but I think not exporting |
It's on purpose that we don't have |
Oh, I see. In that case, should I close this PR? |
Bidiagonal
,Symmetric
, andHermitian
are currently all missing theX(A::Matrix, uplo::Char)
constructor but have theX(A::Matrix, uplo::Symbol)
constructor. This PR adds theChar
constructor.Two additional methods
Symmetric(A::AbstractArray) = Symmetric(A, :U)
andHermitian(A::AbstractMatrix) = Hermitian(A, :U)
were also added to avoid the method overwriting warning (due to the previous implementation having default arguments) and to preserve the historical default argument.NOTE: This PR should be submitted after #42466, which adds better
uplo
checks to the constructors.HEAD:
This PR:
and likewise for
Symmetric
, andHermitian
.