Skip to content
Merged
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
1 change: 1 addition & 0 deletions src/environments/bp_environments.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ struct BPEnv{T}
"4 x rows x cols array of message tensors, where the first dimension specifies the spatial direction"
messages::Array{T, 3}
end
TensorKit.storagetype(::Type{BPEnv{T}}) where {T} = storagetype(T)

"""
Construct a message tensor on a certain bond of a network,
Expand Down
5 changes: 5 additions & 0 deletions src/environments/ctmrg_environments.jl
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@ CTMRGEnv(env::CTMRGEnv) = CTMRGEnv(env.corners, env.edges)

@non_differentiable CTMRGEnv(state::Union{InfinitePartitionFunction, InfinitePEPS}, args...)

function TensorKit.storagetype(::Type{CTMRGEnv{C, E}}) where {C, E}
T = promote_type(scalartype(C), scalartype(E))
return TensorKit.promote_storagetype(T, C, E)
end

# Custom adjoint for CTMRGEnv constructor, needed for fixed-point differentiation
function ChainRulesCore.rrule(
::Type{CTMRGEnv}, corners::Array{C, 3}, edges::Array{T, 3}
Expand Down
1 change: 1 addition & 0 deletions src/environments/suweight.jl
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ TensorKit.spacetype(w::SUWeight) = spacetype(typeof(w))
TensorKit.spacetype(::Type{T}) where {E, T <: SUWeight{E}} = spacetype(E)
TensorKit.sectortype(w::SUWeight) = sectortype(typeof(w))
TensorKit.sectortype(::Type{<:SUWeight{T}}) where {T} = sectortype(spacetype(T))
TensorKit.storagetype(::Type{SUWeight{T}}) where {T} = storagetype(T)

## Bipartite check
function _is_bipartite(wts::SUWeight)
Expand Down
4 changes: 1 addition & 3 deletions src/networks/infinitesquarenetwork.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ end
## Spaces

TensorKit.spacetype(::Type{T}) where {T <: InfiniteSquareNetwork} = spacetype(eltype(T))
function TensorKit.storagetype(::Type{T}) where {T <: InfiniteSquareNetwork}
return storagetype(eltype(T))
end
TensorKit.storagetype(::Type{InfiniteSquareNetwork{O}}) where {O} = storagetype(O)
virtualspace(n::InfiniteSquareNetwork, r::Int, c::Int, dir) = virtualspace(n[r, c], dir)

## Vector interface
Expand Down
1 change: 1 addition & 0 deletions src/operators/localoperator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ function add_term!(
return operator
end

TensorKit.storagetype(lo::LocalOperator{T, S}) where {T, S} = TensorKit.promote_storagetype(values(lo.terms)...)

"""
checklattice(Bool, args...)
Expand Down
3 changes: 3 additions & 0 deletions src/operators/transfermatrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ function MultilineTransferPEPO(T::InfinitePEPS, O::InfinitePEPO, dir)
return MPSKit.Multiline(map(cr -> InfiniteTransferPEPO(T, O, dir, cr), 1:rowsize))
end

TensorKit.storagetype(::Type{InfiniteTransferPEPS{T}}) where {T} = storagetype(T)
TensorKit.storagetype(::Type{InfiniteTransferPEPO{H, T, O}}) where {H, T, O} = TensorKit.promote_storagetype(T, O)

#
# Common interface
#
Expand Down
2 changes: 2 additions & 0 deletions test/testsuite/boundarymps/vumps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ function boundary_mps_one_one_peps(AT)
Vpeps = ComplexSpace(2)
psi = adapt(AT, InfinitePEPS(Vpeps, Vpeps))
T = PEPSKit.InfiniteTransferPEPS(psi, 1, 1)
@test TensorKit.storagetype(T) <: AT
foreach(V -> (@test V == Vpeps ⊗ Vpeps'), physicalspace(T))
mps = initialize_mps(T, [ComplexSpace(20)])

Expand Down Expand Up @@ -117,6 +118,7 @@ function boundary_mps_pepo_runthrough(AT)
O = ising_pepo(1)
psi = adapt(AT, PEPSKit.initializePEPS(O, Vpeps))
T = InfiniteTransferPEPO(psi, O, 1, 1)
@test TensorKit.storagetype(T) <: AT
foreach(V -> (@test V == Vpeps ⊗ Vpepo ⊗ Vpeps'), physicalspace(T))

mps = initialize_mps(rand, scalartype(T), T, [ComplexSpace(10)])
Expand Down
1 change: 1 addition & 0 deletions test/types/localoperator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ if !is_buildkite

terms = ((CartesianIndex(1, 1), CartesianIndex(1, 2)) => t,)
op = LocalOperator(physical_spaces, terms...)
@test TensorKit.storagetype(op) == TensorKit.storagetype(t)

@test op isa LocalOperator
@test length(op.terms) == 1
Expand Down
Loading