-
Notifications
You must be signed in to change notification settings - Fork 1
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
Refactor Ansatz
to be a concrete type with lattice information
#223
base: master
Are you sure you want to change the base?
Conversation
@@ -26,24 +26,9 @@ include("Ansatz/Ansatz.jl") | |||
export Ansatz | |||
export socket, Scalar, State, Operator | |||
export boundary, Open, Periodic | |||
export form | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not export it?
@mofeing @starsfordummies I think that when we talked about splitting the large PR into small ones, we meant that this PR would only contain the new |
Sorry, but I don't agree. The The other ansatzes will be reimplemented in subsequent PRs because tests had to be changed. |
2742acd
to
7a870b7
Compare
…top of recent changes
7a870b7
to
0bef4a9
Compare
… circunvent a Julia bug" This reverts commit 7c67f58.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to have @test_skip
instead of commenting all the tests.
@@ -8,35 +8,35 @@ | |||
@test issetequal(sites(tn), [site"1", site"2", site"1'", site"2'"]) | |||
@test Tenet.ntensors(tn) == 2 | |||
|
|||
@testset "GHZ Circuit" begin | |||
circuit_GHZ = chain(n_qubits, put(1 => Yao.H), Yao.control(1, 2 => Yao.X), Yao.control(2, 3 => Yao.X)) | |||
# @testset "GHZ Circuit" begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# @testset "GHZ Circuit" begin | |
@test_skip begin #@testset "GHZ Circuit" |
@@ -1,33 +1,33 @@ | |||
@testset "Product ansatz" begin | |||
using LinearAlgebra | |||
# @testset "Product ansatz" begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# @testset "Product ansatz" begin | |
@test_skip begin # @testset "Product ansatz" |
@@ -0,0 +1,2 @@ | |||
@testset "Ansatz" begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm on it.
- Either `threshold` or `maxdim` must be provided. If both are provided, `maxdim` is used. | ||
- The bond must contain the Schmidt coefficients, i.e. a site canonization must be performed before calling `truncate!`. | ||
""" | ||
function truncate!(tn::AbstractAnsatz, bond; threshold=nothing, maxdim=nothing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO we should have truncate only for Canonical
or MixedCanonical
now
That's a valid request and a good idea. Will change it now and recover the deleted tests as |
As discussed offline, we decided to slice #204 into smaller PRs. This first PR makes
Ansatz
a concrete type with lattice information contained in a graph.The important thing you should review is the API, not the details; we can change the graph type in the future but we want the API to be stable.
Changelog
Ansatz
a concrete type in the type hierarchy.AbstractAnsatz
.Graphs
andMetaGraphsNext
as dependencies.Chain
,Product
,Grid
andDense
Ansatz
layer.Form
as the trait canonical form information.evolve!
methods based on simple-update tosimple_update!
and generalize it for anyAbstractAnsatz
.Notes
Ansatz
due to its fieldlattice
being abstractactive_reg_inner
crashes onTuple{X} where {X}
EnzymeAD/Enzyme.jl#19231.10.61.10.7Ansatz
to just 1D connectivity (i.e.Site{1}
) but I'm removing it now -> For the time being you will need Julia 1.11 if you want to diff anAnsatz
Base.in
orGraphMakie.graphplot!
onAbstractTensorNetwork
) that I'm gonna remove now and move to other PRs.