Skip to content

Commit

Permalink
fix nothing comparsion (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
lpawela authored Mar 20, 2024
1 parent 8330759 commit 9cc37a8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/contractions/site.jl
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,15 @@ function contract_tensors43(M::SiteTensor{R,4}, B::Tensor{R,3}) where {R<:Real}
@inbounds Bp = B[:, :, p4] .* reshape(M.loc_exp, 1, 1, :)
@cast Bp[(x, y), z] := Bp[x, y, z]
ip123 = SparseCSC(R, M.lp, M.projs[1], M.projs[2], M.projs[3], device)
@show nnz(ip123)
@show size(ip123)
@show size(Bp)
@show size(Bp')
@show typeof(Bp)
@show typeof(ip123)
@show typeof(Bp')
@show (sm1, sm2, sm3, sb1, sb2)
@show size(ip123 * Bp')
out = reshape(ip123 * Bp', sm1, sm2, sm3, sb1, sb2)
out = permutedims(out, (4, 1, 5, 3, 2))
reshape(out, sb1 * sm1, sb2 * sm3, sm2)
Expand Down
4 changes: 2 additions & 2 deletions src/contractions/sparse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ end
# TODO shouldn't we have CSR format instead?
function SparseCSC(::Type{R}, p::CuArray{Int64,1}; mp = nothing) where {R<:Real}
n = length(p)
if mp == nothing
if isnothing(mp)
mp = maximum(p)
end
cn = CuArray(1:n+1) # aux_cusparse(R, n)
Expand All @@ -22,7 +22,7 @@ end

function SparseCSC(::Type{R}, p::Vector{Int64}; mp = nothing) where {R<:Real}
n = length(p)
if mp == nothing
if isnothing(mp)
mp = maximum(p)
end
cn = collect(1:n)
Expand Down
2 changes: 1 addition & 1 deletion src/transfer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ end



which_device(ten::Nothing) = Set()
which_device(::Nothing) = Set()
which_device::Union{QMpo{T},QMps{T}}) where {T} =
union(which_device.(values.tensors))...)
which_device(ten::MpoTensor) =
Expand Down

0 comments on commit 9cc37a8

Please sign in to comment.