-
Notifications
You must be signed in to change notification settings - Fork 0
dev/add support for trace #68
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
base: main
Are you sure you want to change the base?
Conversation
- Add assertion tests for matmul of impure tensors Signed-off-by: Gausshj <[email protected]>
- Add trace support for tensor - Add simply test for trace Signed-off-by: Gausshj <[email protected]>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This reverts commit 156b5d0.
grassmann_tensor/tensor.py
Outdated
if edge_first != edge_end: | ||
raise ValueError(f"Incompatible edges: {edge_first} and {edge_end}.") | ||
|
||
if tensor.arrow[trace_pair[0]] != tensor.arrow[trace_pair[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.
相互trace的两个指标的arrow应该是相反的
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.
好的,已在8d23116中提交了修改。
order_first = order.pop(trace_pair[0]) | ||
order_end = order.pop(trace_pair[1]) | ||
order[trace_pair[0] : trace_pair[0]] = [order_first, order_end] | ||
tensor = tensor.permute(tuple(order)) |
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.
建议你新实现一个只支持对最后两个指标进行trace的版本
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.
不然你对符号的处理完全不对,最后两个指标trace的时候,T F的话,不需要加任何符号,F T的话,需要根据最后两个指标的parity加符号(2个相互trace的指标的parity应该是完全一致的)。
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.
那能否通过permute来实现,将需要trace的指标移到最后,然后再按照当前的代码逻辑来求trace?
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.
那能否通过permute来实现,将需要trace的指标移到最后,然后再按照当前的代码逻辑来求trace?
是的,确实是应该这么干的,先实现下最后两个指标的,然后外面套个permute。
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.
只要你能把两个指标的trace写对,后面套permute很难写错,所以建议你先把两个指标的版本写对。
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.
然后再按照当前的代码逻辑来求trace
你现在的符号没处理对啊
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.
不是没处理对符号,是没处理符号=_=、、、你只需要permute成T F的话,符号才可以恰好不用处理。
- Remove unnecessary judge for arrow Signed-off-by: Gausshj <[email protected]>
Add support for trace