Closed jofrevalles closed 1 year ago
Merging #52 (a035e3d) into master (641f114) will increase coverage by
0.02%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## master #52 +/- ##
==========================================
+ Coverage 82.11% 82.14% +0.02%
==========================================
Files 12 12
Lines 615 616 +1
==========================================
+ Hits 505 506 +1
Misses 110 110
Impacted Files | Coverage Δ | |
---|---|---|
src/TensorNetwork.jl | 86.27% <100.00%> (+0.09%) |
:arrow_up: |
This seems like a rewrite of something that should already work (maybe with some bug fixes) and the refactor seems much more verbose.
- Fixed the
replace!
function forSymbol
pairs to correctly check if target symbols are not already present in the network. The line!isdisjoint(values(old_new), labels(tn)) && throw(...)
was updated to!isdisjoint(last.(old_new), labels(tn)) && throw(...)
.
Okay, super. My bad for using values
instead of last
.
- Updated the
replace!
function forTensor
pairs to now accept multiple replacements instead of just one. This allows for more efficient and convenient replacement of multiple tensors within a network.
mmm this was already working. Was there any bug?
- Added new tests to ensure the correctness of the updated
replace!
function for bothSymbol
andTensor
pairs. The new tests check the previous error in thereplace!
function for symbols and the functionality of multiple tensor replacements.
Nice.
In general, I don't understand the reasons behind the refactor. Could explain yourself a little bit more?
@mofeing I think that now the branch is ready to merge.
Summary
This PR includes several improvements to the
replace!
function in theTensorNetwork
module:replace!
function forSymbol
pairs to correctly check if target symbols are not already present in the network. The line!isdisjoint(values(old_new), labels(tn)) && throw(...)
was updated to!isdisjoint(last.(old_new), labels(tn)) && throw(...)
.replace!
function forTensor
pairs to now accept multiple replacements instead of just one. This allows for more efficient and convenient replacement of multiple tensors within a network.replace!
function for bothSymbol
andTensor
pairs. The new tests check the previous error in thereplace!
function for symbols and the functionality of multiple tensor replacements.Example
Example of multiple replacements of
Tensor
s: