-
Notifications
You must be signed in to change notification settings - Fork 8
Handle full contraction in Flops computation #474
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
Previously Flops::operator() assumed tensor products produced a tensor as a result. This throws an error from ContractedIndexCount when all indices are contracted. Full contraction is now handled correctly and cost is computed as 2 * O^occ * V^virt. Note that we only use the info from left, because it is a full contraction it will be the same as right.
See 0a237de. A new test case added which mimics CC energy expression.
01d745b to
132b285
Compare
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.
Pull request overview
Updates flop-cost computation to correctly account for tensor–tensor products that fully contract to a scalar (e.g., CC energy expressions), and adds a regression test covering this case.
Changes:
- Extend
Flops::operator()to handletensor × tensor → scalarproducts. - Add a unit test for a CC energy-like scalar expression and its expected asymptotic cost.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
SeQuant/core/eval/eval_node.hpp |
Adds a scalar-result path for tensor–tensor products in flop-cost estimation. |
tests/unit/test_eval_node.cpp |
Adds a regression test validating scalar-result contractions and expected asy_cost. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
In case this is not satisfied, we should catch it before, but just to be safe.
bimalgaudel
left a comment
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.
This code:
- has not been updated in long time
- only assumes occupied and virtuals (unoccupied) orbital spaces
- maybe should be deprecated..
@bimalgaudel Will the revisions in #462 make this obsolete? |
|
|
@evaleev @bimalgaudel Can I merge this now? We can deprecate or remove AsyCost in #462. |
Flops::operator()to handle the case wheretensor × tensor → scalar