Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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,7 +1,7 @@
name = "ITensorNetworks"
uuid = "2919e153-833c-4bdc-8836-1ea460a35fc7"
authors = ["Matthew Fishman <[email protected]>, Joseph Tindall <[email protected]> and contributors"]
version = "0.13.10"
version = "0.13.11"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Expand Down
8 changes: 5 additions & 3 deletions src/formnetworks/bilinearformnetwork.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ function Base.copy(blf::BilinearFormNetwork)
)
end

function itensor_identity_map(i_pairs::Vector)
function itensor_identity_map(elt::Type, i_pairs::Vector)
return prod(i_pairs; init=ITensor(one(Bool))) do i_pair
return denseblocks(delta(last(i_pair), dag(first(i_pair))))
return denseblocks(delta(elt, last(i_pair), dag(first(i_pair))))
end
end

itensor_identity_map(i_pairs::Vector) = itensor_identity_map(Float64, i_pairs)

function BilinearFormNetwork(
bra::AbstractITensorNetwork,
ket::AbstractITensorNetwork;
Expand All @@ -72,7 +74,7 @@ function BilinearFormNetwork(
operator_inds = union_all_inds(s, s_mapped)

O = ITensorNetwork(operator_inds; link_space) do v
return inds -> itensor_identity_map(s[v] .=> s_mapped[v])
return inds -> itensor_identity_map(scalartype(ket), s[v] .=> s_mapped[v])
end
return BilinearFormNetwork(O, bra, ket; dual_site_index_map, kwargs...)
end
Expand Down
6 changes: 4 additions & 2 deletions src/specialitensornetworks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ end
"""
Build an ITensor network on a graph specified by the inds network s. Bond_dim is given by link_space and entries are randomised (normal distribution, mean 0 std 1)
"""
function random_tensornetwork(rng::AbstractRNG, eltype::Type, s::IndsNetwork; kwargs...)
return ITensorNetwork(s; kwargs...) do v
function random_tensornetwork(
rng::AbstractRNG, eltype::Type, s::IndsNetwork; link_space=1, kwargs...
)
return ITensorNetwork(s; link_space, kwargs...) do v
return inds -> itensor(randn(rng, eltype, dim.(inds)...), inds)
end
end
Expand Down
Loading