Further changes to S.4/Fig.3 example.

master
Aaron Huber 2022-06-07 22:47:50 -04:00
parent d8b870b595
commit f88cc1ca0b
2 changed files with 5 additions and 5 deletions

View File

@ -99,7 +99,7 @@ and computing the average of $\vari{Y}$ gives us our final estimate. To illustra
%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$.
%Given the computed values of \onepass, \sampmon picks a sampling path by traversing both children of a $\circmult$ gate and randomly choosing a child from a $\circplus$ gate according to the weight $\frac{\abs{\circuit_i}\inparen{1,\ldots, 1}}{\abs{\circuit}\inparen{1,\ldots, 1}}$ for $i\in\inset{\linput, \rinput}$.
%then uses the weights provided by \onepass to randomly select a monomial from $\expansion{\circuit}$.
To sample the monomial $-XY$ in~\Cref{fig:circuit}, \sampmon recursively traverses both children of the sink $\circmult$ gate. Since both red and purple children are $\circplus$ gates, \sampmon then randomly selects the left child of red gate with the aforementioned probability and the right child of the purple gate with probability $\frac{1}{3}$, computed likewise. Note that the probabilty for choosing both the red and purple gates is $\frac{1}{9}$, which is indeed the ratio of the number of $-XY$ terms to the total number of terms in $\expansion{\circuit}$, thus a correct sampling probability. For the recursive call on the red gate, $\inparen{X, 1}$ is returned, while the purple gate recursively visits both children of the sampled $\circmult$ gate, returning $\inparen{Y, 1}$. %Multiplying $-1 \circmult XY$, concludes the random sampling of monomial $-XY$. Suppose \sampmon also randomly samples $X$ and $-Y$ from $\rpoly$ in a call to \approxq. To estimate $\rpoly\inparen{\vct{\prob}}$, \approxq computes $\prob_X - \prob_X\prob_Y - \prob_Y$ and scales the accumulation accordingly.
To sample the monomial $\inparen{XY, -1}$ in~\Cref{fig:circuit}, \sampmon recursively traverses both children of the sink $\circmult$ gate. Since both red and purple children are $\circplus$ gates, \sampmon then randomly selects the left child of red gate with the aforementioned probability and the right child of the purple gate with probability $\frac{1}{3}$, computed likewise. Note that the probabilty for choosing both the red and purple gates is $\frac{1}{9}$, which is indeed the ratio of the number of $\inparen{XY, -1}$ terms to the total number of terms in $\expansion{\circuit}$, thus a correct sampling probability. For the recursive call on the red gate, $\inparen{X, 1}$ is returned, while the purple gate recursively visits both children of the sampled $\circmult$ gate, returning $\inparen{Y, 1}$. %Multiplying $-1 \circmult XY$, concludes the random sampling of monomial $-XY$. Suppose \sampmon also randomly samples $X$ and $-Y$ from $\rpoly$ in a call to \approxq. To estimate $\rpoly\inparen{\vct{\prob}}$, \approxq computes $\prob_X - \prob_X\prob_Y - \prob_Y$ and scales the accumulation accordingly.
%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 algorithm details are in \Cref{sec:proofs-approx-alg}.
%%%%%%%%%%%%%%%%%%%%%%%

View File

@ -17,9 +17,9 @@ Each gate has the following members: \type, \vari{input}, %\val,
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\colorlet{figray}{black!65}
\colorlet{fillred}{red!65}
\colorlet{fillblue}{blue!65}
\colorlet{fillpurple}{purple!65}
\colorlet{fillred}{red!45}
\colorlet{fillblue}{blue!45}
\colorlet{fillbrown}{brown!45}
\begin{wrapfigure}{r}{0.2\textwidth}
%\begin{figure}[t!]
\centering
@ -36,7 +36,7 @@ Each gate has the following members: \type, \vari{input}, %\val,
\node[tree_node, fill = fillblue] (c2) at (3.75, 0.75) {$\boldsymbol{\circmult}$};
\node[tree_node, fill = fillred] (a3) at (0.55, 1.5) {$\boldsymbol{\circplus}$};
\node[tree_node, fill = fillpurple] (b3) at (3.75, 1.5) {$\boldsymbol{\circplus}$};
\node[tree_node, fill = fillbrown] (b3) at (3.75, 1.5) {$\boldsymbol{\circplus}$};
\node[tree_node] (a4) at (2.25, 2.25) {$\boldsymbol{\circmult}$};
%%%%%%%%%%%%%%