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

Update SweepOperator.jl #10

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "SweepOperator"
uuid = "7522ee7d-7047-56d0-94d9-4bc626e7058d"
version = "0.3.3"
version = "0.3.4"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
8 changes: 4 additions & 4 deletions src/SweepOperator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function sweep!(A::AMat, k::Integer, inv::Bool = false)
sweep_with_buffer!(Vector{eltype(A)}(undef, size(A, 2)), A, k, inv)
end

function sweep!(A::AMat{T}, ks::AVec{I}, inv::Bool = false) where {T<:BlasFloat, I<:Integer}
function sweep!(A::AMat{T}, ks::AVec{<:Integer}, inv::Bool = false) where {T<:BlasFloat}
Copy link
Owner

Choose a reason for hiding this comment

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

why treat I and T differently here?

Copy link
Author

Choose a reason for hiding this comment

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

cause T is used in the function body while I is not — anyway, just a matter of style.

akk = Vector{T}(undef, size(A,1))
for k in ks
sweep_with_buffer!(akk, A, k, inv)
Expand Down Expand Up @@ -66,15 +66,15 @@ function syrk!(A::StridedMatrix{T}, α::T, x::AbstractArray{<:T}) where {T<:Blas
BLAS.syrk!('U', 'N', α, x, one(T), A)
end

function syrk!(A::Hermitian{T, S}, α::T, x::AbstractArray{<:T}) where {T<:BlasNumber, S<:StridedMatrix{T}}
function syrk!(A::Hermitian{T, <:StridedMatrix{T}}, α::T, x::AbstractArray{<:T}) where {T<:BlasNumber}
Hermitian(BLAS.syrk!('U', 'N', α, x, one(T), A.data))
end

function syrk!(A::Symmetric{T, S}, α::T, x::AbstractArray{<:T}) where {T<:BlasNumber, S<:StridedMatrix{T}}
function syrk!(A::Symmetric{T, <:StridedMatrix{T}}, α::T, x::AbstractArray{<:T}) where {T<:BlasNumber}
Symmetric(BLAS.syrk!('U', 'N', α, x, one(T), A.data))
end

function syrk!(A, α, x) where {T}
function syrk!(A, α, x)
p = checksquare(A)
for i in 1:p, j in i:p
@inbounds A[i,j] += α * x[i] * x[j]
Expand Down