Conversation
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
|
|
||
| function get_new_cost!(C, plan, tmp, Cμ, Cν) | ||
| A_batched_mul_B!(tmp, Cμ, plan) | ||
| return A_batched_mul_B!(C, tmp, -4Cν) |
There was a problem hiding this comment.
The multiplication with -4 introduces additional allocations. I wonder if this could be avoided, e.g., by updating in-place or some additional cache.
There was a problem hiding this comment.
Dealt with now (in-place scaling of tmp)
| if to_check_step == 0 || iter == maxiter | ||
| # reset counter | ||
| to_check_step = check_convergence | ||
| isconverged = sum(abs, plan - plan_prev) < max(_atol, _rtol * norm_plan) |
There was a problem hiding this comment.
norm_plan is never updated it seems but always set to sum(plan) of the initial randomly initialized plan?
There was a problem hiding this comment.
Maybe also avoid allocations here by writing:
| isconverged = sum(abs, plan - plan_prev) < max(_atol, _rtol * norm_plan) | |
| plan_prev .-= plan # used as a temporary array here to reduce allocations | |
| isconverged = sum(abs, plan_prev) < max(_atol, _rtol * norm_plan) |
There was a problem hiding this comment.
norm_planis never updated it seems but always set tosum(plan)of the initial randomly initializedplan?
The initial plan is taken to be the independent coupling and here we only consider the balanced problem, so norm_plan should not change. I agree however this is a special case of the unbalanced problem where it would not be constant.
There was a problem hiding this comment.
Maybe also avoid allocations here by writing:
Good catch, done
Co-authored-by: David Widmann <devmotion@users.noreply.github.com>
Co-authored-by: David Widmann <devmotion@users.noreply.github.com>
Pull Request Test Coverage Report for Build 4024858001Details
💛 - Coveralls |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #165 +/- ##
==========================================
+ Coverage 95.30% 95.53% +0.22%
==========================================
Files 14 15 +1
Lines 681 716 +35
==========================================
+ Hits 649 684 +35
Misses 32 32 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
No description provided.