Skip to content

Relax eltype condition in rdiv! with Diagonal #40942

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 7 commits into from
May 30, 2021
Merged

Relax eltype condition in rdiv! with Diagonal #40942

merged 7 commits into from
May 30, 2021

Conversation

ArunS-tack
Copy link
Contributor

@ArunS-tack ArunS-tack commented May 25, 2021

Closes JuliaLang/LinearAlgebra.jl#849.

Before
julia> rdiv!(ones(2,2), 3I(2)) ERROR: MethodError: no method matching rdiv!(::Matrix{Float64}, ::Diagonal{Int64, Vector{Int64}})

After
julia> rdiv!(ones(2,2), 3I(2)) 2×2 Matrix{Float64}: 0.333333 0.333333 0.333333 0.333333

@dkarrasch dkarrasch changed the title updating diagonal.jl wref #40887 Relax eltype condition in rdiv! with Diagonal May 28, 2021
@dkarrasch dkarrasch added the linear algebra Linear algebra label May 28, 2021
ArunS-tack and others added 2 commits May 28, 2021 17:11
Co-authored-by: Daniel Karrasch <daniel.karrasch@posteo.de>
Co-authored-by: Daniel Karrasch <daniel.karrasch@posteo.de>
@dkarrasch
Copy link
Member

Maybe this is an opportunity to remove even more of the same-eltype conditions related to Diagonals? The same pattern can be seen in a few ldiv! and rdiv! methods below and above the current changes. I think it's safe to remove them. The functions will complain anyway if the target eltype cannot store the result type of the division.

@ArunS-tack
Copy link
Contributor Author

I deleted the main repository for this PR since you had reviewed and approved the changes (mainly because it was made from master and not a sub-branch). I can open another PR to implement what you suggested.

@dkarrasch
Copy link
Member

I deleted the main repository for this PR since you had reviewed and approved the changes (mainly because it was made from master and not a sub-branch). I can open another PR to implement what you suggested.

Sounds good.

@dkarrasch dkarrasch merged commit 14f2b73 into JuliaLang:master May 30, 2021
shirodkara pushed a commit to shirodkara/julia that referenced this pull request Jun 9, 2021
Co-authored-by: Daniel Karrasch <daniel.karrasch@posteo.de>
johanmon pushed a commit to johanmon/julia that referenced this pull request Jul 5, 2021
Co-authored-by: Daniel Karrasch <daniel.karrasch@posteo.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linear algebra Linear algebra
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rdiv!(randn(4,4), I(4)) fails
3 participants