-
Notifications
You must be signed in to change notification settings - Fork 18
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
Fix contraction tree #536
Fix contraction tree #536
Conversation
…anagement and functionality - Renamed PsudoUniTensor to PseudoUniTensor for consistency. - Replaced raw pointers with smart pointers (std::unique_ptr) in PseudoUniTensor to enhance memory safety. - Updated constructors and assignment operators to support move semantics. - Introduced helper functions for optimal tree solving and connected components detection. - Enhanced SearchTree class to utilize the new PseudoUniTensor structure and improved error handling. - Added unit tests for SearchTree functionality, covering various scenarios including basic contraction orders and error cases. This refactor aims to streamline tensor contraction processes and improve overall code maintainability.
…mproved memory management - Updated Node class to inherit from std::enable_shared_from_this for better shared pointer management. - Replaced raw pointers with std::shared_ptr and std::weak_ptr in Node to prevent memory leaks and circular references. - Modified constructors and assignment operators in Node and ContractionTree to support smart pointer usage. - Adjusted methods in ContractionTree to work with shared pointers, enhancing safety and clarity. - Updated related code in RegularGncon and RegularNetwork to accommodate changes in Node handling. This refactor aims to enhance memory safety and maintainability in tensor contraction processes.
…anagement and debugging output - Added debug output for setting root pointers in Node class to aid in tracing. - Introduced a new method `set_root_ptrs()` to streamline root pointer assignment. - Updated constructors to set node names based on children for better identification. - Refactored `reset_nodes()` and `reset_contraction_order()` methods for clearer logic and safety. - Enhanced error handling in `set_root_ptrs()` to manage potential weak pointer issues. - Updated tests to include debug information during network creation. These changes aim to improve the clarity and maintainability of the contraction tree structure, facilitating easier debugging and understanding of tensor relationships.
…ity and functionality - Clear previous base nodes before creating new ones to ensure a fresh state. - Implemented a loop to properly create and assign names to base nodes using smart pointers. - Enhanced the structure of the FromString method for better readability. These changes aim to streamline the initialization of base nodes in the contraction tree, improving maintainability and clarity in the network setup process.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev-master #536 +/- ##
==============================================
+ Coverage 17.85% 23.64% +5.79%
==============================================
Files 211 211
Lines 44766 44911 +145
Branches 14956 15039 +83
==============================================
+ Hits 7992 10620 +2628
- Misses 32636 32641 +5
+ Partials 4138 1650 -2488 ☔ View full report in Codecov by Sentry. |
I saw a few commit with clang format. Are you using pre-commit tool? It will auto format for you |
I moved from vscode to cursor so my extension setup are messed up. Will fix it. |
…functionality of linear algebra 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.
All tests have passed, and additional tests have been added for this change
This PR implements the algorithm described in Faster identification of optimal contraction sequences for tensor networks by Robert N. C. Pfeifer, Jutho Haegeman, Frank Verstraete to fix #506
Raw pointers are replaced with smart pointers for to improve the memory management in
SearchTree
,ContractionTree
,Node
, andPseudoUniTensor
classes. Ranged for loop is used when possible.Need to further tests on edge cases.