Skip to content

Commit

Permalink
Finish name change & get tests working
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanlevy committed Mar 21, 2024
1 parent 936938d commit 7c08a0a
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: ['1.8']
julia-version: ['1.10']
julia-arch: [x64,]
os: [macOS-latest, ubuntu-latest]
exclude:
Expand Down
7 changes: 5 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name = "QTTITensorNetworks"
name = "TensorNetworkFunctionals"
uuid = "666f501e-685d-4e36-ab44-ece85df6022b"
authors = ["Joseph Tindall <[email protected]>", "Ryan Levy <[email protected]>"]
version = "0.1.0"

[deps]
DataGraphs = "b5a273c3-7e6c-41f6-98bd-8d7f1525a36a"
Dictionaries = "85a47980-9c8c-11e8-2b9f-f7ca1fa99fb4"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
EllipsisNotation = "da5c29d0-fa7d-589e-88eb-ea29b0a81949"
Glob = "c27321d9-0574-5035-807b-f59d2c89b15c"
Expand All @@ -12,7 +14,8 @@ ITensorNetworks = "2919e153-833c-4bdc-8836-1ea460a35fc7"
ITensors = "9136182c-28ba-11e9-034c-db9fb085ebd5"
NamedGraphs = "678767b0-92e7-4007-89e4-4527a8725b19"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SplitApplyCombine = "03a91e81-4c3e-53e1-a0a4-9c0c8f19dd66"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
ITensorNetworks = "0.3"
ITensorNetworks = "0.4"
14 changes: 0 additions & 14 deletions src/QTTITensorNetworks.jl

This file was deleted.

26 changes: 26 additions & 0 deletions src/TensorNetworkFunctionals.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module TensorNetworkFunctionals

using ITensors
using ITensorNetworks
using NamedGraphs
using EllipsisNotation
using Graphs

using ITensorNetworks: delta_network
using NamedGraphs: add_edges, random_bfs_tree, rem_edges

#include("QTT_utils.jl")
include("itensornetworksutils.jl")
export ITensorNetworkFunction
export BitMap,
default_dimension_map,vertex,calculate_xyz,calculate_x,calculate_bit_values,
dimension
export const_itensornetwork,exp_itensornetwork,cosh_itensornetwork,
sinh_itensornetwork,tanh_itensornetwork,cos_itensornetwork,
sin_itensornetwork,get_edge_toward_root,polynomial_itensornetwork
export const_itn,poly_itn,cosh_itn,sinh_itn,
tanh_itn,exp_itn,sin_itn,cos_itn
export calculate_fx


end
8 changes: 4 additions & 4 deletions src/itensornetworks_elementary_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ function cosh_itensornetwork(
return ITensorNetworkFunction(ψ1 + ψ2, bit_map)
end

function cosh_itensornetwork(s::IndsNetwork, bit_map; kwargs...)
return cosh_itensornetwork(s::IndsNetwork, bit_map, 1; kwargs...)
end

#function cosh_itensornetwork(s::IndsNetwork, bit_map; kwargs...)
# return cosh_itensornetwork(s::IndsNetwork, bit_map, 1; kwargs...)
#end
#
"""Construct the bond dim 2 representation of the sinh(kx+a) function for x ∈ [0,1] as an ITensorNetwork, using an IndsNetwork which
defines the network geometry. Vertex map provides the ordering of the sites as bits"""
function sinh_itensornetwork(
Expand Down
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using Test
using Glob
using ITensorNetworks
using QTTITensorNetworks
using TensorNetworkFunctionals

# https://discourse.julialang.org/t/rdir-search-recursive-for-files-with-a-given-name-pattern/75605/12
@testset "test directory $root" for (root, dirs, files) in
walkdir(joinpath(pkgdir(QTTITensorNetworks), "test"))
walkdir(joinpath(pkgdir(TensorNetworkFunctionals), "test"))
test_files = filter!(f -> occursin(Glob.FilenameMatch("test_*.jl"), f), files)
@testset "Test file $test_file" for test_file in test_files
println("Running test file $test_file")
Expand Down
7 changes: 6 additions & 1 deletion test/test_bitmaps.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
using Test
using TensorNetworkFunctionals
using ITensors
using ITensorNetworks
using SplitApplyCombine
using Dictionaries

include("../src/itensornetworksutils.jl")
#include("../src/itensornetworksutils.jl")

@testset "test single dimensional bit map" begin
L = 4
Expand Down
9 changes: 7 additions & 2 deletions test/test_itensorfunction.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
using Test
using TensorNetworkFunctionals
using ITensorNetworks
using Random
using Distributions
using Graphs

include("../src/itensornetworksutils.jl")
#include("../src/itensornetworksutils.jl")

@testset "test constructor from ITensorNetwork" begin
L = 10
Expand Down Expand Up @@ -86,7 +91,7 @@ end
###Generate a series of random polynomials on random graphs. Evaluate them at random x values"""
for deg in degrees
Random.seed!(1234 * deg)
g = NamedGraph(Graphs.SimpleGraph(uniform_tree(L)))
g = ITensorNetworks.NamedGraph(Graphs.SimpleGraph(uniform_tree(L)))
g = rename_vertices(g, Dict(zip(vertices(g), [(v, 1) for v in vertices(g)])))
s = siteinds("S=1/2", g)

Expand Down

0 comments on commit 7c08a0a

Please sign in to comment.