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
[deps] | |
Git = "d7ba0133-e1db-5d97-8f8c-041e4b3a1eb2" | |
ITensorPkgSkeleton = "3d388ab1-018a-49f4-ae50-18094d5f71ea" | |
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" | |
RegistryInstances = "2792f1a3-b283-48e8-9a74-f99dce5104f3" | |
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb" |
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
module KroneckerIndexing | |
using Kronecker: Kronecker, ⊗ | |
kronecker_arguments(a::AbstractArray) = Kronecker.getmatrices(a) | |
struct KroneckerIndex | |
A::Int | |
B::Int | |
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
using ExplicitImports: explicit_imports | |
using SplitApplyCombine: group | |
function prepend_line(file, string) | |
f = open(file, "r+") | |
buf = IOBuffer() | |
write(buf, string * "\n") | |
write(buf, f) | |
seekstart(buf) | |
seekstart(f) |
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
function template(; user, authors) | |
@eval begin | |
using PkgTemplates | |
default_git_ignore() = [ | |
"*.o", | |
"*.swp", | |
".tmp", | |
"Manifest.toml", | |
"docs/build/", | |
".DS_Store", |
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
_setdiff(s) = Base.copymutable(s) | |
_setdiff(s, itrs...) = _setdiff!(Base.copymutable(s), itrs...) | |
function _setdiff!(s, itrs...) | |
for x in itrs | |
_setdiff!(s, x) | |
end | |
return s | |
end | |
function _setdiff!(s, itr) | |
isempty(s) && return s |
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
using ITensors | |
# A type that specifies the model. Used | |
# for dispatch on functions `mpo` and | |
# `localham_term`. | |
struct Model{model} end | |
Model(s::AbstractString) = Model{Symbol(s)}() | |
# For notation: |
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
#include "itensor/all.h" | |
using namespace itensor; | |
IQIndex | |
directSum(IQIndex const& i, IQIndex const& j, Args const& args = Args::global()) | |
{ | |
auto name = args.getString("IndexName","sum"); | |
#ifdef DEBUG | |
if( i.dir() != j.dir() ) Error("In directSum(IQIndex, IQIndex), input indices must have same arrow direction"); |