diff --git a/exact.tex b/exact.tex index 3877cb0..37800ab 100644 --- a/exact.tex +++ b/exact.tex @@ -1,19 +1,27 @@ % -*- root: main.tex -*- \section{Exact Results} \label{sec:exact} -We turn to computing the exact values of $\sum\limits_{\wVec \in \pw } \sketchJParam{\sketchHashParam{\wVec}} \cdot \sketchPolarParam{\wVecPrime}.$ Starting with the term $\gIJ = \sum\limits_{\wVecPrime \in \pw}\sketchPolarParam{\wVecPrime}$, by the definition of $\sketchPolar$ and the property of associativity in addition, we can break the sum into +We turn to computing the exact values of +\begin{equation} +\sum\limits_{\wVec \in \pw } \sketchJParam{\sketchHashParam{\wVec}}\sketchPolarParam{\wVec} = +\sum\limits_{\wVec \in \pw } \kMapParam{\wVec}\sketchPolarParam{\wVec} +\sum_{\substack{\wVecPrime \in \pw\st\\ + \sketchHashParam{\wVec} = \sketchHashParam{\wVecPrime}}} \sketchPolarParam{\wVecPrime}\label{eq:exact-results} . +\end{equation} +Starting with the latter term $\gIJ = \sum\limits_{\wVecPrime \in \pw}\sketchPolarParam{\wVecPrime}$, by the definition of the image of $\sketchPolar$ and the property of associativity in addition, we can break the sum into \begin{equation*} \gIJ = \sum_{\substack{\wVecPrime \in \pw \st\\ \sketchPolarParam{\wVecPrime} = 0}} 1 + \sum_{\substack{\wVecPrime \in \pw \st\\ \sketchPolarParam{\wVecPrime} = 1}} -1. \end{equation*} -Setting the terms to $T_1 = \sum_{\substack{\wVecPrime \in \pw \st\\ - \sketchPolarParam{\wVecPrime} = 0}} 1$ and $T_2 = \sum_{\substack{\wVecPrime \in \pw \st\\ - \sketchPolarParam{\wVecPrime} = 1}} -1$ and fixing $\buck$ to a specific value, gives a system of linear equations for each term. It is a known result for a consistent multiplication that the number of solutions are $| \kDom |^{\numTup - rank(\matrixH')}$. This gives us an exact calculation for both terms, +Setting the terms to $T_1 = \sum\limits_{\substack{\wVecPrime \in \pw \st\\ + \sketchPolarParam{\wVecPrime} = 0}} 1$ and $T_2 = \sum\limits_{\substack{\wVecPrime \in \pw \st\\ + \sketchPolarParam{\wVecPrime} = 1}} -1$ and fixing $\buck$ to a specific value, gives a system of linear equations for each term. It is a known result for a consistent matrix multiplication that the number of solutions are $| \kDom |^{\numTup - rank(\matrixH')}$, where $\kDom$ is the set being considered. This gives us an exact calculation for both terms, \begin{align*} -T_1 \in \{0, 2^{\numTup - rank(\matrixH')}\},\\ -T_1 \in \{0, 2^{\numTup - rank(\matrixH')}\}. +T_1 = |\{\wVec \st \matrixH' \cdot \wVec = \buck^{(0)}\}|\rightarrow T_1 \in \{0, 2^{\numTup - rank(\matrixH')}\},\\ +T_2 = |\{\wVec \st \matrixH' \cdot \wVec = \buck^{(1)}\}|\rightarrow T_2 \in \{0, 2^{\numTup - rank(\matrixH')}\}, \end{align*} +where the notation $\jpbit{y}$ denotes the polarity bit $\lenB$ value of the $\buck$ bucket identifier, specifically $\buck(b)$, such that $\buck(b)\in \{0, 1\}$. \subsection{Algorithm for $\gIJ$} \begin{algorithmic} @@ -26,25 +34,25 @@ T_1 \in \{0, 2^{\numTup - rank(\matrixH')}\}. \ElsIf{$\matrixH' \cdot \wVec = \buck^{(1)}$ is consistent} \State $\gIJ = 2^{\numTup - computeRank(\matrixH')}$ \Else - $\gIJ = 0$ + \State $\gIJ = 0$ \EndIf. \end{algorithmic} -For examining the first term of equation \eqref{eq:allWorlds-est}, we fix $\kMap{t}$ to be defined as +For examining the first term of equation \eqref{eq:exact-results}, we fix $\kMap{t}$ to be defined as \begin{equation*} \kMapParam{\wVec} = \begin{cases} 1,&\text{if } w_t = 1\\ 0, &\text{otherwise}. \end{cases} \end{equation*} -Therefore, by definition we have -\begin{equation*} -\sum_{\wVec \in \pw}\sketchJParam{\sketchHashParam{\wVec}} = \sum_{\wVec \in \pw}\kMapParam{\wVec}\sketchPolarParam{\wVec}, -\end{equation*} -and using the same argument as in $\gIJ$ yields +%Therefore, by definition we have +%\begin{equation*} +%\sum_{\wVec \in \pw}\sketchJParam{\sketchHashParam{\wVec}} = \sum_{\wVec \in \pw}\kMapParam{\wVec}\sketchPolarParam{\wVec}, +%\end{equation*} +Using the same argument as in $\gIJ$ yields \begin{equation*} \sum_{\wVec \in \pw \st \sketchPolarParam{\wVec} = 0}\kMapParam{\wVec} - \sum_{\wVec \in \pw \st \sketchPolarParam{\wVec} = 1}\kMapParam{\wVec}. \end{equation*} -Setting $T_3 = \sum_{\wVec \in \pw \st \sketchPolarParam{\wVec} = 0}\kMapParam{\wVec}$, $T_4 = \sum_{\wVec \in \pw \st \sketchPolarParam{\wVec} = 1}\kMapParam{\wVec}$, +Setting $T_3 = \sum\limits_{\wVec \in \pw \st \sketchPolarParam{\wVec} = 0}\kMapParam{\wVec}$, $T_4 = \sum\limits_{\wVec \in \pw \st \sketchPolarParam{\wVec} = 1}\kMapParam{\wVec}$ gives an exact calculation for each term given a fixed $\buck$: \begin{equation*} T_3 = | \{\wVec \st \matrixH \cdot \wVec = \buck^{(0)}, \kMapParam{\wVec} = 1\}\rightarrow T_3 \in [0, 2^{\numTup - rank(\matrixH')}] \end{equation*} @@ -52,4 +60,17 @@ T_3 = | \{\wVec \st \matrixH \cdot \wVec = \buck^{(0)}, \kMapParam{\wVec} = 1\}\ T_4 = | \{\wVec \st \matrixH \cdot \wVec = \buck^{(1)}, \kMapParam{\wVec} = 1\}\rightarrow T_4 \in [0, 2^{\numTup - rank(\matrixH') - 1}] \end{equation*} -\AH{Next: define the algorithm for initialization of $\sketchJParam{\sketchHashParam{\wVec}}$} \ No newline at end of file + + + +\subsection{Algorithm for Initialization} +\begin{algorithmic} +\ForAll{$\wVec \st \kMapParam{\wVec} = 1$} + \State $\buck = \matrixH' \cdot \wVec$ + \If{$\buck(\lenB) = 0$} + \State $\sketchIj += 1$ + \Else + \State$\sketchIj -= 1$ + \EndIf +\EndFor. +\end{algorithmic} \ No newline at end of file diff --git a/hash_const.tex b/hash_const.tex index c1629e7..bb28359 100644 --- a/hash_const.tex +++ b/hash_const.tex @@ -10,11 +10,11 @@ As with world identification, bucket identification can be viewed as a binary ve \end{equation*} The row hash function $\sketchHash$ that maps input to buckets is defined as the multiplication of the matrix $\matrixH \cdot \wVec = \jVec$ , as \begin{equation*} -\hVecMatrix \cdot \vecCol{w} = \vecCol{j}, +\hVecMatrix \cdot \vecCol{w}{\numTup} = \vecCol{j}{\lenB - 1}, \end{equation*} or equivalently \begin{equation*} -\sketchHash = \buck = \forall i \in [\lenB], \buck_i = \langle\textbf{h}_i, \wVec\rangle +\sketchHash = \buck = \forall i \in [\lenB], j_i = \langle\textbf{h}_{i, k}, \wVec\rangle \end{equation*} Polarity function $\sketchPolar$ is analogously defined as the inner product of a precomputed vector (abusing notation) $\mathbf{\sketchPolar}$ and $\wVec$, diff --git a/macros.tex b/macros.tex index 1ae8281..0bd58b8 100644 --- a/macros.tex +++ b/macros.tex @@ -26,11 +26,12 @@ \vdots \\ h_{i, \lenB, 0} &\cdots &h_{\lenB, \numTup} \end{pmatrix*}} -\newcommand{\vecCol}[1]{\begin{pmatrix} +\newcommand{\vecCol}[2]{\begin{pmatrix} {#1}_0 \\ \vdots \\ - {#1}_{\numTup} + {#1}_{#2} \end{pmatrix}} +\newcommand{\jpbit}[1]{\buck^{(#1)}} % %TIDB %