-
Notifications
You must be signed in to change notification settings - Fork 2
Automatic Runic.jl run #90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "TensorAlgebra" | ||
uuid = "68bd88dc-f39d-4e12-b2ca-f046b68fcc6a" | ||
authors = ["ITensor developers <[email protected]> and contributors"] | ||
version = "0.4.3" | ||
version = "0.4.4" | ||
|
||
[deps] | ||
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a" | ||
|
@@ -13,20 +13,20 @@ TensorProducts = "decf83d6-1968-43f4-96dc-fdb3fe15fc6d" | |
TupleTools = "9d95972d-f1c8-5527-a6e0-b4b365fa01f6" | ||
TypeParameterAccessors = "7e5a90cf-f82e-492e-a09b-e3e26432c138" | ||
|
||
[weakdeps] | ||
TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2" | ||
|
||
[extensions] | ||
TensorAlgebraTensorOperationsExt = "TensorOperations" | ||
|
||
[compat] | ||
ArrayLayouts = "1.10.4" | ||
BlockArrays = "1.7.2" | ||
EllipsisNotation = "1.8.0" | ||
LinearAlgebra = "1.10" | ||
MatrixAlgebraKit = "0.2, 0.3, 0.4" | ||
TensorProducts = "0.1.5" | ||
TensorOperations = "5" | ||
TensorProducts = "0.1.5" | ||
TupleTools = "1.6.0" | ||
TypeParameterAccessors = "0.2.1, 0.3, 0.4" | ||
julia = "1.10" | ||
|
||
[weakdeps] | ||
TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2" | ||
|
||
[extensions] | ||
TensorAlgebraTensorOperationsExt = "TensorOperations" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,11 +25,11 @@ This step is only required once. | |
```julia | ||
julia> using Pkg: Pkg | ||
|
||
julia> Pkg.Registry.add(url="https://github.com/ITensor/ITensorRegistry") | ||
julia> Pkg.Registry.add(url = "https://github.com/ITensor/ITensorRegistry") | ||
``` | ||
or: | ||
```julia | ||
julia> Pkg.Registry.add(url="[email protected]:ITensor/ITensorRegistry.git") | ||
julia> Pkg.Registry.add(url = "[email protected]:ITensor/ITensorRegistry.git") | ||
``` | ||
if you want to use SSH credentials, which can make it so you don't have to enter your Github ursername and password when registering packages. | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,75 @@ | ||
function extract_contract_labels(contraction::AbstractString) | ||
symbolsC = match(r"C\[([^\]]*)\]", contraction) | ||
labelsC = split(symbolsC.captures[1], ","; keepempty=false) | ||
symbolsA = match(r"A\[([^\]]*)\]", contraction) | ||
labelsA = split(symbolsA.captures[1], ","; keepempty=false) | ||
symbolsB = match(r"B\[([^\]]*)\]", contraction) | ||
labelsB = split(symbolsB.captures[1], ","; keepempty=false) | ||
return labelsC, labelsA, labelsB | ||
symbolsC = match(r"C\[([^\]]*)\]", contraction) | ||
labelsC = split(symbolsC.captures[1], ","; keepempty = false) | ||
symbolsA = match(r"A\[([^\]]*)\]", contraction) | ||
labelsA = split(symbolsA.captures[1], ","; keepempty = false) | ||
symbolsB = match(r"B\[([^\]]*)\]", contraction) | ||
labelsB = split(symbolsB.captures[1], ","; keepempty = false) | ||
return labelsC, labelsA, labelsB | ||
end | ||
|
||
function generate_contract_benchmark( | ||
line::AbstractString; elt=Float64, alg=default_contract_alg(), do_alpha=true, do_beta=true | ||
) | ||
line_split = split(line, " & ") | ||
@assert length(line_split) == 2 "Invalid line format:\n$line" | ||
contraction, sizes = line_split | ||
line::AbstractString; elt = Float64, alg = default_contract_alg(), do_alpha = true, do_beta = true | ||
) | ||
line_split = split(line, " & ") | ||
@assert length(line_split) == 2 "Invalid line format:\n$line" | ||
contraction, sizes = line_split | ||
|
||
# extract labels | ||
labelsC, labelsA, labelsB = map(Tuple, extract_contract_labels(contraction)) | ||
# pA, pB, pC = TensorOperations.contract_indices( | ||
# tuple(labelsA...), tuple(labelsB...), tuple(labelsC...) | ||
# ) | ||
# extract labels | ||
labelsC, labelsA, labelsB = map(Tuple, extract_contract_labels(contraction)) | ||
# pA, pB, pC = TensorOperations.contract_indices( | ||
# tuple(labelsA...), tuple(labelsB...), tuple(labelsC...) | ||
# ) | ||
|
||
# extract sizes | ||
subsizes = Dict{String,Int}() | ||
for (label, sz) in split.(split(sizes, "; "; keepempty=false), Ref(":")) | ||
subsizes[label] = parse(Int, sz) | ||
end | ||
szA = getindex.(Ref(subsizes), labelsA) | ||
szB = getindex.(Ref(subsizes), labelsB) | ||
szC = getindex.(Ref(subsizes), labelsC) | ||
setup_tensors() = (rand(elt, szA...), rand(elt, szB...), rand(elt, szC...)) | ||
# extract sizes | ||
subsizes = Dict{String, Int}() | ||
for (label, sz) in split.(split(sizes, "; "; keepempty = false), Ref(":")) | ||
subsizes[label] = parse(Int, sz) | ||
end | ||
szA = getindex.(Ref(subsizes), labelsA) | ||
szB = getindex.(Ref(subsizes), labelsB) | ||
szC = getindex.(Ref(subsizes), labelsC) | ||
setup_tensors() = (rand(elt, szA...), rand(elt, szB...), rand(elt, szC...)) | ||
|
||
if do_alpha && do_beta | ||
α, β = rand(elt, 2) | ||
return @benchmarkable( | ||
contract!($alg, C, $labelsC, A, $labelsA, B, $labelsB, $α, $β), | ||
setup = ((A, B, C) = $setup_tensors()), | ||
evals = 1 | ||
) | ||
elseif do_alpha | ||
α = rand(elt) | ||
return @benchmarkable( | ||
contract!($alg, C, $labelsC, A, $labelsA, B, $labelsB, $α), | ||
setup = ((A, B, C) = $setup_tensors()), | ||
evals = 1 | ||
) | ||
elseif do_beta | ||
β = rand(elt) | ||
return @benchmarkable( | ||
contract!($alg, C, $labelsC, A, $labelsA, B, $labelsB, true, $β), | ||
setup = ((A, B, C) = $setup_tensors()), | ||
evals = 1 | ||
) | ||
else | ||
return @benchmarkable( | ||
contract!($alg, C, $labelsC, A, $labelsA, B, $labelsB), | ||
setup = ((A, B, C) = $setup_tensors()), | ||
evals = 1 | ||
) | ||
end | ||
if do_alpha && do_beta | ||
α, β = rand(elt, 2) | ||
return @benchmarkable( | ||
contract!($alg, C, $labelsC, A, $labelsA, B, $labelsB, $α, $β), | ||
setup = ((A, B, C) = $setup_tensors()), | ||
evals = 1 | ||
) | ||
elseif do_alpha | ||
α = rand(elt) | ||
return @benchmarkable( | ||
contract!($alg, C, $labelsC, A, $labelsA, B, $labelsB, $α), | ||
setup = ((A, B, C) = $setup_tensors()), | ||
evals = 1 | ||
) | ||
elseif do_beta | ||
β = rand(elt) | ||
return @benchmarkable( | ||
contract!($alg, C, $labelsC, A, $labelsA, B, $labelsB, true, $β), | ||
setup = ((A, B, C) = $setup_tensors()), | ||
evals = 1 | ||
) | ||
else | ||
return @benchmarkable( | ||
contract!($alg, C, $labelsC, A, $labelsA, B, $labelsB), | ||
setup = ((A, B, C) = $setup_tensors()), | ||
evals = 1 | ||
) | ||
end | ||
end | ||
|
||
function compute_contract_ops(line::AbstractString) | ||
line_split = split(line, " & ") | ||
@assert length(line_split) == 2 "Invalid line format:\n$line" | ||
_, sizes = line_split | ||
line_split = split(line, " & ") | ||
@assert length(line_split) == 2 "Invalid line format:\n$line" | ||
_, sizes = line_split | ||
|
||
# extract sizes | ||
subsizes = Dict{String,Int}() | ||
for (label, sz) in split.(split(sizes, "; "; keepempty=false), Ref("=")) | ||
subsizes[label] = parse(Int, sz) | ||
end | ||
return prod(collect(values(subsizes))) | ||
# extract sizes | ||
subsizes = Dict{String, Int}() | ||
for (label, sz) in split.(split(sizes, "; "; keepempty = false), Ref("=")) | ||
subsizes[label] = parse(Int, sz) | ||
end | ||
return prod(collect(values(subsizes))) | ||
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
using TensorAlgebra: TensorAlgebra | ||
using Documenter: Documenter, DocMeta, deploydocs, makedocs | ||
|
||
DocMeta.setdocmeta!(TensorAlgebra, :DocTestSetup, :(using TensorAlgebra); recursive=true) | ||
DocMeta.setdocmeta!( | ||
TensorAlgebra, :DocTestSetup, :(using TensorAlgebra); recursive = true | ||
) | ||
|
||
include("make_index.jl") | ||
|
||
makedocs(; | ||
modules=[TensorAlgebra], | ||
authors="ITensor developers <[email protected]> and contributors", | ||
sitename="TensorAlgebra.jl", | ||
format=Documenter.HTML(; | ||
canonical="https://itensor.github.io/TensorAlgebra.jl", | ||
edit_link="main", | ||
assets=["assets/favicon.ico", "assets/extras.css"], | ||
), | ||
pages=["Home" => "index.md", "Reference" => "reference.md"], | ||
modules = [TensorAlgebra], | ||
authors = "ITensor developers <[email protected]> and contributors", | ||
sitename = "TensorAlgebra.jl", | ||
format = Documenter.HTML(; | ||
canonical = "https://itensor.github.io/TensorAlgebra.jl", | ||
edit_link = "main", | ||
assets = ["assets/favicon.ico", "assets/extras.css"], | ||
), | ||
pages = ["Home" => "index.md", "Reference" => "reference.md"], | ||
) | ||
|
||
deploydocs(; | ||
repo="github.com/ITensor/TensorAlgebra.jl", devbranch="main", push_preview=true | ||
repo = "github.com/ITensor/TensorAlgebra.jl", devbranch = "main", push_preview = true | ||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# # TensorAlgebra.jl | ||
# | ||
# | ||
# [](https://itensor.github.io/TensorAlgebra.jl/stable/) | ||
# [](https://itensor.github.io/TensorAlgebra.jl/dev/) | ||
# [](https://github.com/ITensor/TensorAlgebra.jl/actions/workflows/Tests.yml?query=branch%3Amain) | ||
|
@@ -22,13 +22,13 @@ | |
```julia | ||
julia> using Pkg: Pkg | ||
|
||
julia> Pkg.Registry.add(url="https://github.com/ITensor/ITensorRegistry") | ||
julia> Pkg.Registry.add(url = "https://github.com/ITensor/ITensorRegistry") | ||
``` | ||
=# | ||
# or: | ||
#= | ||
```julia | ||
julia> Pkg.Registry.add(url="[email protected]:ITensor/ITensorRegistry.git") | ||
julia> Pkg.Registry.add(url = "[email protected]:ITensor/ITensorRegistry.git") | ||
``` | ||
=# | ||
# if you want to use SSH credentials, which can make it so you don't have to enter your Github ursername and password when registering packages. | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.