-
Notifications
You must be signed in to change notification settings - Fork 0
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #27 +/- ##
==========================================
+ Coverage 72.94% 75.00% +2.05%
==========================================
Files 8 8
Lines 414 436 +22
==========================================
+ Hits 302 327 +25
+ Misses 112 109 -3 ☔ View full report in Codecov by Sentry. |
Question for @bsc-quantic/tensor-networks: should we do that the I think that makes sense that we do not (so like it is currently in the code), and just take the tensor at that |
|
||
@test length(tensors(canonized)) == 9 # 5 tensors + 4 singular values vectors | ||
@test isapprox( | ||
contract(transform(TensorNetwork(canonized), Tenet.HyperindConverter())), |
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 think you no longer need to do the Tenet.HyperindConverter
transformation to be able to contract. Would you mind updating your Tenet installation and trying it?
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 now tried using Tenet v0.5.2
and it did not work without the Tenet.HyperindConverter
.
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.
First batch of requests. There is one thing that you don't test and I think it's very important: the norm of the TN. The L2-norm of each of the singular value vector on each bond should give the same value, and equal to contract(tn)
.
@mofeing The code now will error due to the |
Okay @mofeing, every test now has passed correctly. I would like to merge this. |
src/Ansatz.jl
Outdated
@@ -84,5 +84,16 @@ function LinearAlgebra.norm(ψ::Ansatz, p::Real = 2; kwargs...) | |||
p != 2 && throw(ArgumentError("p=$p is not implemented yet")) | |||
|
|||
# TODO: Replace with contract(hcat(ψ, ψ')...) when implemented | |||
return contract(merge(TensorNetwork(ψ), TensorNetwork(ψ')); kwargs...) |> only |> sqrt |> abs | |||
value = contract(merge(TensorNetwork(ψ), TensorNetwork(ψ')); kwargs...) | |||
println("value: $(inds(value))") |
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.
??
Summary
This PR resolves #22 by implementing the
canonize
function, which takes an inputChain
and transforms it into the canonical form (also known as Vidal form), where we have a set ofΓ
andΛ
tensors. For now, this function is implemented forChain
withOpen
boundaries.Additionally, we added some tests to cover for the new function. Thanks to @starsfordummies for the useful comments!
Example
Let's show how this function works: