Do not query the other side of a product if one side is zero
When taking the cauchy dot product we query both terms of each product in the sum, even if one of terms is already zero. If we encounter a zero term, we should not query the other term for efficiency.
The behavior of exclude_last
is similar, where the highest order is not queried when the 0th order is zero. This would be a generalization of that for all orders.
This would likely implemented inside product_by_order
. A way to do query_but_dont_eval
could be useful to implement this.
There are two approaches (or a combination of the two) to find zero terms. Will have to figure out which approach is most efficient.
- Query (but don't evaluate) each side, check for zero.
- Query (and evaluate if necessary) the lowest order term first, check for zero.
See this mattermost thread for the initial idea.