-
Notifications
You must be signed in to change notification settings - Fork 89
More axpby methods for Diagonals #665
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
|
Your PR requires formatting changes to meet the project's style guidelines. Click here to view the suggested changes.diff --git a/src/host/linalg.jl b/src/host/linalg.jl
index bc59996..e17d08d 100644
--- a/src/host/linalg.jl
+++ b/src/host/linalg.jl
@@ -309,11 +309,13 @@ function LinearAlgebra.mul!(C::Diagonal{<:Any, <:AbstractGPUArray},
return C
end
-function LinearAlgebra.mul!(C::Diagonal{<:Any, <:AbstractGPUArray},
- A::Diagonal{<:Any, <:AbstractGPUArray},
- B::Diagonal{<:Any, <:AbstractGPUArray},
- α::Number,
- β::Number)
+function LinearAlgebra.mul!(
+ C::Diagonal{<:Any, <:AbstractGPUArray},
+ A::Diagonal{<:Any, <:AbstractGPUArray},
+ B::Diagonal{<:Any, <:AbstractGPUArray},
+ α::Number,
+ β::Number
+ )
dc = C.diag
da = A.diag
db = B.diag
@@ -339,14 +341,16 @@ function LinearAlgebra.mul!(C::Diagonal{<:Any, <:AbstractGPUArray},
return C
end
-function LinearAlgebra.mul!(C::Diagonal{<:Any, <:AbstractGPUArray},
- A::Union{AbstractGPUArray, Adjoint{T,<:AbstractGPUArray{T}}, Transpose{T,<:AbstractGPUArray{T}}},
- B::Union{AbstractGPUArray, Adjoint{T,<:AbstractGPUArray{T}}, Transpose{T,<:AbstractGPUArray{T}}},
- α::Number,
- β::Number) where {T}
+function LinearAlgebra.mul!(
+ C::Diagonal{<:Any, <:AbstractGPUArray},
+ A::Union{AbstractGPUArray, Adjoint{T, <:AbstractGPUArray{T}}, Transpose{T, <:AbstractGPUArray{T}}},
+ B::Union{AbstractGPUArray, Adjoint{T, <:AbstractGPUArray{T}}, Transpose{T, <:AbstractGPUArray{T}}},
+ α::Number,
+ β::Number
+ ) where {T}
dc = C.diag
- d = length(dc)
- m, n = size(A, 1), size(A, 2)
+ d = length(dc)
+ m, n = size(A, 1), size(A, 2)
m′, n′ = size(B, 1), size(B, 2)
m == d || throw(DimensionMismatch("left hand side has $m rows but output is $d by $d"))
n′ == d || throw(DimensionMismatch("right hand side has $n′ cols but output is $d by $d"))
@@ -386,8 +390,9 @@ function LinearAlgebra.mul!(B::AbstractGPUVecOrMat,
end
function LinearAlgebra.mul!(B::AbstractGPUVecOrMat,
- A::Union{AbstractGPUArray, Adjoint{T,<:AbstractGPUArray{T}}, Transpose{T,<:AbstractGPUArray{T}}},
- D::Diagonal{<:Any, <:AbstractGPUArray}) where {T}
+ A::Union{AbstractGPUArray, Adjoint{T, <:AbstractGPUArray{T}}, Transpose{T, <:AbstractGPUArray{T}}},
+ D::Diagonal{<:Any, <:AbstractGPUArray}
+ ) where {T}
dd = D.diag
d = length(dd)
m, n = size(A, 1), size(A, 2)
@@ -401,10 +406,11 @@ function LinearAlgebra.mul!(B::AbstractGPUVecOrMat,
end
function LinearAlgebra.mul!(B::AbstractGPUVecOrMat,
- A::Union{AbstractGPUArray, Adjoint{T,<:AbstractGPUArray{T}}, Transpose{T,<:AbstractGPUArray{T}}},
+ A::Union{AbstractGPUArray, Adjoint{T, <:AbstractGPUArray{T}}, Transpose{T, <:AbstractGPUArray{T}}},
D::Diagonal{<:Any, <:AbstractGPUArray},
α::Number,
- β::Number) where {T}
+ β::Number
+ ) where {T}
dd = D.diag
d = length(dd)
m, n = size(A, 1), size(A, 2) |
63a34a1 to
d06cc29
Compare
Member
|
@kshyatt Can I push test fixes? |
Member
Author
|
Go for it
…On Thu, Dec 4, 2025 at 3:24 PM Christian Guinard ***@***.***> wrote:
*christiangnrd* left a comment (JuliaGPU/GPUArrays.jl#665)
<#665 (comment)>
@kshyatt <https://github.com/kshyatt> Can I push test fixes?
—
Reply to this email directly, view it on GitHub
<#665 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGKJY7ZK3QX5M4TYGRJJAD4AA7ZTAVCNFSM6AAAAACN2NJJM2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTMMJSGUYDSOJZGY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Member
Author
|
Good to merge? Huge shoutout to @christiangnrd for getting this in shape |
maleadt
approved these changes
Dec 5, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These dispatch to bad places in
LinearAlgebra.jlotherwise