Skip to content

Commit

Permalink
remove conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
kdomino committed Dec 22, 2020
2 parents 8cc0bea + e307eea commit 1495a2a
Show file tree
Hide file tree
Showing 20 changed files with 345 additions and 167 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/CI.yml
@@ -0,0 +1,36 @@
name: CI
on:
- push
- pull_request
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1.5'
os:
- ubuntu-latest
- macOS-latest
arch:
- x64
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
env:
JULIA_NUM_THREADS: 4
- uses: julia-actions/julia-processcoverage@v1
# - uses: codecov/codecov-action@v1
# with:
# file: lcov.info
- uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: lcov.info
16 changes: 16 additions & 0 deletions .github/workflows/CompatHelper.yml
@@ -0,0 +1,16 @@
name: CompatHelper
on:
schedule:
- cron: '00 00 * * *'
workflow_dispatch:
jobs:
CompatHelper:
runs-on: ubuntu-latest
steps:
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMPATHELPER_PRIV: ${{ secrets.COVERALLS_TOKEN }}
run: julia -e 'using CompatHelper; CompatHelper.main()'
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

24 changes: 6 additions & 18 deletions Manifest.toml
Expand Up @@ -132,12 +132,6 @@ git-tree-sha1 = "50ddf44c53698f5e784bbebb3f4b21c5807401b1"
uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
version = "0.8.3"

[[Documenter]]
deps = ["Base64", "Dates", "DocStringExtensions", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "REPL", "Test", "Unicode"]
git-tree-sha1 = "fb1ff838470573adc15c71ba79f8d31328f035da"
uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
version = "0.25.2"

[[ExprTools]]
git-tree-sha1 = "7fce513fcda766962ff67c5596cb16c463dfd371"
uuid = "e2ba6199-217a-4e67-a87a-7c52f15ade04"
Expand Down Expand Up @@ -191,6 +185,12 @@ git-tree-sha1 = "f4435ce0055d4da938f3bab0c0e523826735c96a"
uuid = "a2cc645c-3eea-5389-862e-a155d0052231"
version = "0.3.1"

[[Infiltrator]]
deps = ["REPL"]
git-tree-sha1 = "2be5c3e8adddf062c3903a6d7618f233fa4d2874"
uuid = "5903a43b-9cc3-4c30-8d17-598619ec4e9b"
version = "0.3.0"

[[Inflate]]
git-tree-sha1 = "f5fc07d4e706b84f72d54eedcc1c13d92fb0871c"
uuid = "d25df0c9-e2be-5dd7-82c8-3ad0b3e990b9"
Expand Down Expand Up @@ -294,12 +294,6 @@ git-tree-sha1 = "9af25a91bda16307caff2a50f9c744c432b8bc1b"
uuid = "6f1432cf-f94c-5a45-995e-cdbf5db27b0b"
version = "1.2.6"

[[MKL]]
deps = ["Libdl", "MKL_jll", "PackageCompiler"]
git-tree-sha1 = "e01175ff53c062c52b6cbe441a4382e132f7c82e"
uuid = "33e6dc65-8f57-5167-99aa-e5a354878fb2"
version = "0.3.0"

[[MKL_jll]]
deps = ["IntelOpenMP_jll", "Libdl", "Pkg"]
git-tree-sha1 = "eb540ede3aabb8284cb482aa41d00d6ca850b1f8"
Expand Down Expand Up @@ -363,12 +357,6 @@ git-tree-sha1 = "16c08bf5dba06609fe45e30860092d6fa41fde7b"
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
version = "1.3.1"

[[PackageCompiler]]
deps = ["Libdl", "Pkg", "UUIDs"]
git-tree-sha1 = "3eee77c94646163f15bd8626acf494360897f890"
uuid = "9b87118b-4619-50d2-8e1e-99f35a4d4d9d"
version = "1.2.3"

[[Parsers]]
deps = ["Dates"]
git-tree-sha1 = "6fa4202675c05ba0f8268a6ddf07606350eda3ce"
Expand Down
10 changes: 5 additions & 5 deletions Project.toml
Expand Up @@ -8,25 +8,25 @@ CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
GraphPlot = "a2cc645c-3eea-5389-862e-a155d0052231"
Infiltrator = "5903a43b-9cc3-4c30-8d17-598619ec4e9b"
LightGraphs = "093fc24a-ae57-5d10-9952-331d41423f4d"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
LowRankApprox = "898213cb-b102-5a47-900c-97e73b919f73"
MetaGraphs = "626554b9-1ddb-594c-aa3c-2596fe9399a5"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
TensorCast = "02d47bb6-7ce6-556a-be16-bb1710789e2b"
TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2"

Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[compat]
TensorOperations = "3.0.1"
julia = "1.4, 1.5"

[extras]
NPZ = "15e1cf62-19b3-5cfa-8e77-841668bca605"
NPZ = "15e1cf62-19b3-5cfa-8e77-841668bca605"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
Expand Down
45 changes: 29 additions & 16 deletions src/PEPS.jl
@@ -1,52 +1,65 @@
export PepsTensor

mutable struct PepsTensor
nbrs::Dict{String, Int}
left::AbstractArray
right::AbstractArray
up::AbstractArray
down::AbstractArray
loc::AbstractArray
tensor::AbstractArray

function PepsTensor(fg::MetaGraph, v::Int)
function PepsTensor(fg::MetaDiGraph, v::Int)
pc = new()
outgoing = outneighbors(fg, v)
incoming = inneighbours(fg, v)
pc.nbrs = Dict()
pc.loc = get_prop(fg, v, :local_exp)

for u outgoing
if get_prop(fg, (v, u), :orientation) == "horizontal"
pc.right = last(get_prop(fg, (v, u), :decomposition))
outgoing = outneighbors(fg, v)
incoming = inneighbors(fg, v)

for u outgoing
e = SimpleEdge(v, u)
if get_prop(fg, e, :orientation) == "horizontal"
pc.right = first(get_prop(fg, e, :decomposition))
push!(pc.nbrs, "h_out" => u)
else
pc.down = last(get_prop(fg, (v, u), :decomposition))
pc.down = first(get_prop(fg, e, :decomposition))
push!(pc.nbrs, "v_out" => u)
end
end

for u incoming
if get_prop(fg, (u, v), :orientation) == "horizontal"
pc.left = first(get_prop(fg, (u, v), :decomposition))
e = SimpleEdge(u, v)
if get_prop(fg, e, :orientation) == "horizontal"
pc.left = last(get_prop(fg, e, :decomposition))
push!(pc.nbrs, "h_in" => u)
else
pc.up = first(get_prop(fg, (u, v), :decomposition))
pc.up = last(get_prop(fg, e, :decomposition))
push!(pc.nbrs, "v_in" => u)
end
end

# open boundary conditions
if pc.left === nothing
if !isdefined(pc, :left)
pc.left = ones(1, size(pc.right, 1))
end

if pc.right === nothing
if !isdefined(pc, :right)
pc.right = ones(size(pc.left, 2), 1)
end

if pc.up === nothing
if !isdefined(pc, :up)
pc.up = ones(1, size(pc.down, 1))
end

if pc.down === nothing
if !isdefined(pc, :down)
pc.down = ones(size(pc.up, 2), 1)
end

pc.tensor[l, r, u, d, σ] |= pc.left[l, σ] * pc.right[σ, r] * pc.up[u, σ] * pc.down[σ, d]
@cast pc.tensor[l, r, u, d, σ] |= pc.loc[σ] * pc.left[l, σ] * pc.right[σ, r] * pc.up[u, σ] * pc.down[σ, d]

pc
end
end
end

Base.size(A::PepsTensor) = size(A.tensor)
1 change: 1 addition & 0 deletions src/SpinGlassPEPS.jl
Expand Up @@ -6,6 +6,7 @@ module SpinGlassPEPS
using LightGraphs
using MetaGraphs
using CSV
using Infiltrator

using DocStringExtensions
const product = Iterators.product
Expand Down
34 changes: 17 additions & 17 deletions src/base.jl
Expand Up @@ -17,33 +17,33 @@ for (T, N) in ((:MPO, 4), (:MPS, 3))
$T(::Type{T}, L::Int) where {T} = $T(Vector{Array{T, $N}}(undef, L))
$T(L::Int) = $T(Float64, L)

Base.setindex!(a::$AT, A::AbstractArray{<:Number, $N}, i::Int) = a.tensors[i] = A
bond_dimension(a::$AT) = maximum(size.(a.tensors, $N))
@inline Base.setindex!(a::$AT, A::AbstractArray{<:Number, $N}, i::Int) = a.tensors[i] = A
@inline bond_dimension(a::$AT) = maximum(size.(a.tensors, $N))
Base.copy(a::$T) = $T(copy(a.tensors))
Base.eltype(::$AT{T}) where {T} = T
@inline Base.eltype(::$AT{T}) where {T} = T
end
end

const AbstractMPSorMPO = Union{AbstractMPS, AbstractMPO}
const MPSorMPO = Union{MPS, MPO}

Base.:(==)(a::AbstractMPSorMPO, b::AbstractMPSorMPO) = a.tensors == b.tensors
Base.:()(a::AbstractMPSorMPO, b::AbstractMPSorMPO) = a.tensors b.tensors
@inline Base.:(==)(a::AbstractMPSorMPO, b::AbstractMPSorMPO) = a.tensors == b.tensors
@inline Base.:()(a::AbstractMPSorMPO, b::AbstractMPSorMPO) = a.tensors b.tensors

Base.getindex(a::AbstractMPSorMPO, i) = getindex(a.tensors, i)
Base.iterate(a::AbstractMPSorMPO) = iterate(a.tensors)
Base.iterate(a::AbstractMPSorMPO, state) = iterate(a.tensors, state)
Base.lastindex(a::AbstractMPSorMPO) = lastindex(a.tensors)
Base.length(a::AbstractMPSorMPO) = length(a.tensors)
Base.size(a::AbstractMPSorMPO) = (length(a.tensors), )
@inline Base.getindex(a::AbstractMPSorMPO, i) = getindex(a.tensors, i)
@inline Base.iterate(a::AbstractMPSorMPO) = iterate(a.tensors)
@inline Base.iterate(a::AbstractMPSorMPO, state) = iterate(a.tensors, state)
@inline Base.lastindex(a::AbstractMPSorMPO) = lastindex(a.tensors)
@inline Base.length(a::AbstractMPSorMPO) = length(a.tensors)
@inline Base.size(a::AbstractMPSorMPO) = (length(a.tensors), )

LinearAlgebra.rank::MPS) = Tuple(size(A, 2) for A ψ)
@inline LinearAlgebra.rank::MPS) = Tuple(size(A, 2) for A ψ)

MPS(A::AbstractArray) = MPS(A, :right)
MPS(A::AbstractArray, s::Symbol, args...) = MPS(A, Val(s), typemax(Int), args...)
MPS(A::AbstractArray, s::Symbol, Dcut::Int, args...) = MPS(A, Val(s), Dcut, args...)
MPS(A::AbstractArray, ::Val{:right}, Dcut::Int, args...) = _left_sweep_SVD(A, Dcut, args...)
MPS(A::AbstractArray, ::Val{:left}, Dcut::Int, args...) = _right_sweep_SVD(A, Dcut, args...)
@inline MPS(A::AbstractArray) = MPS(A, :right)
@inline MPS(A::AbstractArray, s::Symbol, args...) = MPS(A, Val(s), typemax(Int), args...)
@inline MPS(A::AbstractArray, s::Symbol, Dcut::Int, args...) = MPS(A, Val(s), Dcut, args...)
@inline MPS(A::AbstractArray, ::Val{:right}, Dcut::Int, args...) = _left_sweep_SVD(A, Dcut, args...)
@inline MPS(A::AbstractArray, ::Val{:left}, Dcut::Int, args...) = _right_sweep_SVD(A, Dcut, args...)

function _right_sweep_SVD::AbstractArray{T}, Dcut::Int=typemax(Int), args...) where {T}
rank = ndims(Θ)
Expand Down

0 comments on commit 1495a2a

Please sign in to comment.