I found several pages about custom sitetypes similar to ITensors.jl: Custom SiteTypes - Specific Domains / Numerics - Julia Programming Language. But it seems the document pages are deprecated. Are there any new document about this topic?
In fact, I have tried to define my sitetype and simply include to my code and got
ERROR: LoadError: Overload of “space”,“siteind”, or “siteinds” functions not found for Index tag: MyType
Here is the test code:
#test.jl
using ITensors, ITensorMPS
include("mytype_test.jl")
sites = siteinds("MyType", 10)
#mytype_test.jl
function space(::SiteType"MyType")
return 2
end
val(::ValName"1", ::SiteType"MyType") = 1
val(::ValName"2", ::SiteType"MyType") = 2
state(::StateName"1", ::SiteType"MyType") = [1.0, 0.0]
state(::StateName"2", ::SiteType"MyType") = [0.0, 1.0]
What’s the right way to do this?