-
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 finding optimal contraction order (WIP) #532
Closed
yingjerkao
wants to merge
15
commits into
dev-master
from
506-cannot-find-the-contraction-order-for-cpu-version
Closed
Fix finding optimal contraction order (WIP) #532
yingjerkao
wants to merge
15
commits into
dev-master
from
506-cannot-find-the-contraction-order-for-cpu-version
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Added comprehensive comments to the `pContract` function in `search_tree.cpp` explaining the XOR operation for tracking tensor contractions. - Clarified the calculation of new tensor shapes and labels after contraction. - Improved readability and maintainability of the code by documenting the contraction history.
…rity - Removed namespace prefix from member function definitions in `search_tree.cpp` for `PseudoUniTensor`. - Updated the assignment operator and constructor implementations to enhance code readability and maintainability. - Ensured consistency in member function declarations by streamlining the syntax.
- Renamed `root` to `root_ptr` for better clarity in `search_tree.hpp`. - Updated `clear()` and `reset_search_order()` methods to use `root_ptr`. - Changed `get_nodes()` to `get_root()` to reflect the method's purpose more accurately. - Ensured consistent use of smart pointers in the SearchTree class.
…zation - Introduced `search_tree_test.cpp` with multiple test cases to validate the SearchTree's behavior, including basic search order, handling of empty trees, single nodes, and disconnected networks. - Updated `CMakeLists.txt` to include the new test file and added address sanitization options for improved debugging.
- Updated PseudoUniTensor constructor to initialize ID and accumulation string. - Refactored pContract function to streamline tensor contraction process and set internal node properties. - Improved error handling in SearchTree::search_order to require at least two base nodes. - Enhanced code readability with additional comments and consistent use of smart pointers.
… handling - Added new test cases to validate optimal contraction order for a network of tensors in `search_tree_test.cpp`. - Updated assertions to check for expected contraction costs and formats. - Improved error handling in `search_order` method to throw `std::logic_error` instead of `std::runtime_error` for empty and single-node trees. - Refactored retrieval of result nodes to use `get_root()` for clarity.
…ntation - Changed adjacency matrix representation from a vector of vectors to a vector of IndexSets for improved performance and memory efficiency. - Updated DFS function to utilize IndexSet for tracking visited nodes, enhancing clarity and reducing overhead. - Added a check for empty tensor input in the solve function to prevent unnecessary processing. - Improved adjacency matrix construction logic to ensure proper sizing and filling based on common tensor labels. - Enhanced component combination logic to create new nodes with calculated costs and properties, improving the overall structure of the tensor network.
… output - Removed debug output for accumulated string in BasicSearchOrder test. - Ensured test cases accurately reflect the intended tensor configurations for better validation.
…on cost and sequence - Adjusted expected contraction cost from 832 to 1536 to reflect the optimal result. - Updated the expected contraction sequence string from "(3,(0,(1,2)))" to "((2,3),(0,1))" for accuracy in validation.
I messed up my branch. Will create a new PR from a new branch. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
The implementation reuses the original data structure and interface as much as possible.
Currently the code compiles and more integration tests are necessary