Another revision of the example in the prior two commits.

master
Aaron Huber 2022-06-04 09:34:55 -04:00
parent cead0a457e
commit 157c8025d4
1 changed files with 3 additions and 3 deletions

View File

@ -94,9 +94,9 @@ Given the above, the algorithm is a sampling based algorithm for the above sum:
to $\abs{\coef}$ and compute $\vari{Y}=\indicator{\isInd{\encMon}}
\cdot \prod_{X_i\in \monom} p_i$.
Repeating the sampling an appropriate number of times
and computing the average of $\vari{Y}$ gives us our final estimate. To illustrate the sampling procedure using~\Cref{fig:circuit}, \onepass recursively visits each gate exactly once, computing $\abs{\circuit}\inparen{1,\ldots, 1}$
for each gate \circuit. If we consider the leftmost source gates, \onepass computes $\abs{\circuit}\inparen{1,\ldots,1} = 1$ for $\circuit.\val = X$ and $\abs{\circuit}\inparen{1,\ldots, 1} = 2$ for $\circuit.\val = 2$. For the leftmost $\circmult$ gate, \onepass computes $\abs{\circuit}\inparen{1,\ldots, 1} = 2\circmult 1$, i.e. $\abs{\circuit_\linput}\inparen{1,\ldots, 1} \times \abs{\circuit_\rinput}\inparen{1,\ldots, 1}$ for children $\circuit_\linput$ and $\circuit_\rinput$. A level higher, the leftmost $\circplus$ gate recursively adds the values of its two children deriving $\abs{\circuit}\inparen{1,\ldots, 1} = 2 \circplus 1$, while simultaneously computing the weights $\frac{1}{3}$ for its left child and $\frac{2}{3}$ for its right. The final sum value is then computed in similar fashion. % yielding $\abs{\circuit}\inparen{1,\ldots, 1} = 3 \circmult 3 = 9$.
\sampmon then uses the weights provided by \onepass to randomly select a monomial from $\expansion{\circuit}$. To sample the monomial $X$, \sampmon recursively traverses both children of the sink gate. Since both children are $\circplus$ gates, \sampmon then randomly select the left child of each $\circplus$ gate with probability $\frac{1}{3}$ and $\frac{2}{3}$ respectively. For the fomer, the leaf node with variable $X$ and sign value $1$ is returned, while the latter visits both children of selected child $\circmult$ gate, recursively returning $X$ with a sign value of $1$. Finally, \sampmon performs the operation $X\cup X = X$, effectively reducing the monomial to its $\rpoly$ valuation.
and computing the average of $\vari{Y}$ gives us our final estimate. To illustrate the sampling procedure using~\Cref{fig:circuit}, \onepass recursively visits each gate \circuit exactly once, computing $\abs{\circuit}\inparen{1,\ldots, 1}$. %for each gate \circuit.
If we consider the leftmost source gates, \onepass computes $\abs{\circuit}\inparen{1,\ldots,1} = 1$ for $\circuit.\val = X$ and $\abs{\circuit}\inparen{1,\ldots, 1} = 2$ for $\circuit.\val = 2$. For the leftmost $\circmult$ gate, \onepass computes $\abs{\circuit}\inparen{1,\ldots, 1} = 2\circmult 1$, i.e. $\abs{\circuit_\linput}\inparen{1,\ldots, 1} \times \abs{\circuit_\rinput}\inparen{1,\ldots, 1}$ for children $\circuit_\linput$ and $\circuit_\rinput$. A level higher, the leftmost $\circplus$ gate recursively adds the values of its two children deriving $\abs{\circuit}\inparen{1,\ldots, 1} = 2 \circplus 1$, while using the expression $\frac{\abs{\circuit_i}\inparen{1,\ldots, 1}}{\abs{\circuit}\inparen{1,\ldots, 1}}$ for $i\in\inset{\linput, \rinput}$ to simultaneously compute the weights $\frac{1}{3}$ and $\frac{2}{3}$ for its children. The final sum value is then computed in similar fashion. % yielding $\abs{\circuit}\inparen{1,\ldots, 1} = 3 \circmult 3 = 9$.
\sampmon then uses the weights provided by \onepass to randomly select a monomial from $\expansion{\circuit}$. To sample the monomial $X$, \sampmon recursively traverses both children of the sink gate. Since both children are $\circplus$ gates, \sampmon then randomly selects the left child of each $\circplus$ gate with probability $\frac{1}{3}$ and $\frac{2}{3}$ respectively. For the fomer, the leaf node with variable $X$ and sign value $1$ is returned, while the latter visits both children of the selected child $\circmult$ gate, recursively returning $X$ with a sign value of $1$. Finally, \sampmon performs the operation $X\cup X = X$, effectively reducing the monomial to its $\rpoly$ valuation.
%such that a source gate \circuit has $\abs{\circuit}\inparen{1,\ldots, 1} = \circuit.\val$ when \circuit.\type $=$ \num and $\abs{\circuit}\inparen{1,\ldots,1} = 1$ otherwise. For every gate \circuit, \onepass computes $\abs{\circuit}\inparen{1,\ldots, 1}$ as seen in the lighter font of~\Cref{fig:circuit}. \onepass further weights each child $\circuit_i$ for $i\in\inset{\linput, \rinput}$, by the expression $\frac{\abs{\circuit_i}\inparen{1,\ldots, 1}}{\abs{\circuit}\inparen{1,\ldots, 1}}$. These weight are the basis for the sampling performed by \sampmon.
All the algorithms details are in \Cref{sec:proofs-approx-alg}.
%%%%%%%%%%%%%%%%%%%%%%%