Update the positions and provisional input_sets of ``results`` based on performing the contraction result ``best``. Remove any involving the tensors contracted. Parameters ---------- results : list List of contraction results produced by ``_parse_possible_contrac
(results, best)
| 286 | |
| 287 | |
| 288 | def _update_other_results(results, best): |
| 289 | """Update the positions and provisional input_sets of ``results`` |
| 290 | based on performing the contraction result ``best``. Remove any |
| 291 | involving the tensors contracted. |
| 292 | |
| 293 | Parameters |
| 294 | ---------- |
| 295 | results : list |
| 296 | List of contraction results produced by |
| 297 | ``_parse_possible_contraction``. |
| 298 | best : list |
| 299 | The best contraction of ``results`` i.e. the one that |
| 300 | will be performed. |
| 301 | |
| 302 | Returns |
| 303 | ------- |
| 304 | mod_results : list |
| 305 | The list of modified results, updated with outcome of |
| 306 | ``best`` contraction. |
| 307 | """ |
| 308 | |
| 309 | best_con = best[1] |
| 310 | bx, by = best_con |
| 311 | mod_results = [] |
| 312 | |
| 313 | for cost, (x, y), con_sets in results: |
| 314 | |
| 315 | # Ignore results involving tensors just contracted |
| 316 | if x in best_con or y in best_con: |
| 317 | continue |
| 318 | |
| 319 | # Update the input_sets |
| 320 | del con_sets[by - int(by > x) - int(by > y)] |
| 321 | del con_sets[bx - int(bx > x) - int(bx > y)] |
| 322 | con_sets.insert(-1, best[2][-1]) |
| 323 | |
| 324 | # Update the position indices |
| 325 | mod_con = x - int(x > bx) - int(x > by), y - int(y > bx) - int(y > by) |
| 326 | mod_results.append((cost, mod_con, con_sets)) |
| 327 | |
| 328 | return mod_results |
| 329 | |
| 330 | def _greedy_path(input_sets, output_set, idx_dict, memory_limit): |
| 331 | """ |
no outgoing calls
no test coverage detected
searching dependent graphs…