-
Notifications
You must be signed in to change notification settings - Fork 12
Tenpy&Quimb&Tensornetwork Transform #25
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
Conversation
tests/test_quantum.py
Outdated
| contraction_nodes + [left_node, right_node], | ||
| output_edge_order=output_edges + input_edges, | ||
| ) | ||
| mat_from_tenpy = tc.backend.reshape( |
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.
the logic for this check is complicated, just check that each local tensor are the same in the two format is okay, no need to do the contraction is the impl is so complicated
| mpo_original = MPO(sites, Ws, IdL=0, IdR=chi_mpo - 1) | ||
|
|
||
| qop_mpo = tc.quantum.tenpy2qop(mpo_original) | ||
| mpo_roundtrip = tc.quantum.qop2tenpy(qop_mpo) |
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.
just check the local tensor are the same after roundtrip is sufficient? no need complicated contraction below.
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.
but sometimes, check the final contracted tensor indeed important as this confirms the connection beside the nodes themselves, so carefully design the tests and keep the necessary parts. There should be direct way and functions to contract the whole MPO or MPS on quimb, tensornetwork and tenpy, aren't they?
tensorcircuit/quantum.py
Outdated
| quimb_tensors = [] | ||
| node_map = {node: i for i, node in enumerate(sorted_nodes)} | ||
| for i, node in enumerate(sorted_nodes): | ||
| tensor_data = np.asarray(node.tensor) |
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 change tensor to numpy format? quimb should also accept jax or tf tensor directly?
tests/test_quantum.py
Outdated
| contraction_nodes + [left_node, right_node], | ||
| output_edge_order=output_edges + input_edges, | ||
| ) | ||
| mat_from_tenpy = np.reshape( |
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.
are there any method in tenpy directly contracting the MPO? the current check further goes back to tn to build the tensor and contract which seems verbose
| if not endpoint_nodes: | ||
| endpoint_nodes = {edge.node1 for edge in qop.ignore_edges if edge.node1} | ||
|
|
||
| if not endpoint_nodes and len(nodes_for_sorting) > 1: |
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.
what is the case here, the min bond should be counted as sum of the bond dimension instead of sum of 1?
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
…puting libraries within the TensorCircuit-NG ecosystem. The primary contribution involves implementing bidirectional conversion functions that enable seamless integration between TensorCircuit's QuOperator format and major tensor network libraries including TeNPy, Quimb, and TensorNetwork.
This work focuses on developing a comprehensive interoperability framework for quantum computing libraries within the TensorCircuit-NG ecosystem. The primary contribution involves implementing bidirectional conversion functions that enable seamless integration between TensorCircuit's QuOperator format and major tensor network libraries including TeNPy, Quimb, and TensorNetwork.