Open davidweichiang opened 1 year ago
Can I get more explanation?
Currently J uses a double loop to compute $\prod_{i \in [n] \setminus {k}} weight(e_i)$ where $weight(e_i)$ is the sum-product of $e_i$'s label if nonterminal, or the weight of its factor if terminal. So it runs in O(|E|^2) time. But it can be reduced to O(|E|) time as follows:
Unfortunately this isn't the easiest fix, because the outer loop is in J
(and J_log
) but the inner loop is in sum_product_edges
.
Thanks, this helps. So to compute $\prod_{i=1,...,k} weight(e_i)$ for example, do you mean a loop like this instead of what sum_product_edges
currently does?
rule.rhs.ext
)Is the size of these intermediate tensors (affected by the edge numbering) a concern then?
Right. I guess the ordering does matter, which is something we haven't thought about at all yet. People who work on tensor networks have thought about this a lot.
It can be changed into a single loop (thanks @darcey).