Skip to content

Conversation

lkdvos
Copy link
Member

@lkdvos lkdvos commented Mar 31, 2025

Fix for #206

@Jutho correct me if I'm wrong, but I think what is going on here is that the initial guess for the maxcost is wrong for these cases:
From what I can tell we use:

$$(\prod_i \chi_i) * \max_i(\chi_i)$$

Which evaluates to 1 in this case, while the actual maximal cost would be (n-1) * 1 with n the number of tensors.
I patched the specific case of all sizes equal to 1, but I am not sure if this now captures all possible problems. (I'm also not entirely sure where the initial formula came from?)

I could also replace this maxcost with the cost of simply multiplying in the order that is supplied, but I'm not sure what the implications are for the algorithm.

@Jutho
Copy link
Member

Jutho commented Mar 31, 2025

I only remember that the initial cost was certainly trial and error, and not particularly clever. The cost of a simple left to right contraction would probably be much more sensible.

@lkdvos
Copy link
Member Author

lkdvos commented Mar 31, 2025

Test failures are unrelated, in principle this should be good to go.

@Jutho Jutho merged commit 54cbd9b into master Apr 1, 2025
15 of 18 checks passed
@mtfishman
Copy link

Thanks for the quick fix @lkdvos! Can you register a new version?

@lkdvos
Copy link
Member Author

lkdvos commented Apr 1, 2025

Should be done relatively soon, but I want to include the precompilation PR as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants