SlowGuess/NeurIPS_2023_OCR huggingface dataset:
where  $\bar{q}_j(Z)$  is defined as in Definition 1. Then for any vector  $\pmb{\nu} \in \mathbb{R}^N$ ,  $\overline{\mathbf{M}} \cdot \pmb{\nu}$  is equivalent to evaluating the polynomial
$$
v (Z) = \sum_ {j = 0} ^ {N - 1} v _ {j} \cdot \bar {q} _ {j} (Z) \tag {33}
$$
at  $\{1,\omega_N,\dots \omega_N^{N - 1}\}$
Proof. By our definition of  $\overline{\mathbf{M}}$ , the column  $\overline{\mathbf{M}}[:, j]$  is exactly the evaluation of the polynomial  $\overline{q}_j(Z)$  at each point in  $A$ . The claimed result comes from the definition of matrix vector multiplication and (33).
Note that  $\overline{\mathbf{M}}$  or any  $\mathbf{M}$ 's in this sub-section are not necessarily Monarch matrices.
Next, we state the following intermediate result:
Proposition 1. Let  $A$  be the set of the  $N$ -th roots of unity. Then for  $\mathbf{M}_1, \mathbf{M}_2$  defined as in (32)
$$
\mathbf {y} = \left(\mathbf {M} _ {1} \cdot \mathbf {k}\right) \odot \left(\mathbf {M} _ {2} \cdot \mathbf {u}\right)
$$
is the same as evaluating the polynomial
$$
p (Z) := k (Z) \cdot u (Z) \mod \left(Z ^ {N} - 1\right)
$$
over  $A$  where  $k(Z), u(Z)$  are of the form (33), corresponding to  $\mathbf{M}_1$  and  $\mathbf{M}_2$ , respectively. In other words, for any  $0 \leq i < N$ ,
$$
\mathbf {y} [ i ] = p \left(\omega_ {N} ^ {i}\right).
$$
Proof. This result follows from Lemma 1 and the definition of the Hadamard product.
Next, we state a re-interpretation of  $\mathbf{M}^{-1}\mathbf{y}$ :
Proposition 2. Let  $\mathbf{M}$  be a full rank matrix whose columns are the evaluations of the basis polynomials  $\bar{q}_j(Z)$  from Definition 1 for  $0 \leq j < N$ , and let  $\mathbf{y} \in \mathbb{R}^N$  be an arbitrary vector. If  $\mathbf{u} = \mathbf{M}^{-1}\mathbf{y}$ , then for all  $0 \leq i < N$
$$
\mathbf {y} [ i ] = u (\omega^ {i})
$$
where  $u(Z)$  is the same as in Lemma 1 for  $\mathbf{M}$ . In other words,  $\mathbf{M}^{-1}\mathbf{y}$  is the polynomial interpolation problem for the polynomial basis  $\bar{q}_j(Z)$  for  $0\le j < N$ .
Proof. This follows from Lemma 1 and the fact that  $\mathbf{M}$  is invertible.
From Propositions 1 and 2, we get the following generalization of Theorem 2:
Theorem 7. For matrices  $\mathbf{M}_0, \mathbf{M}_1, \mathbf{M}_2$  as defined above, the operation
$$
\mathbf {f} = \mathbf {M} _ {0} ^ {- 1} \cdot \left(\left(\mathbf {M} _ {1} \cdot \mathbf {k}\right) \circ \left(\mathbf {M} _ {2} \cdot \mathbf {u}\right)\right)
$$
$$
f (Z) = k (Z) \cdot u (Z) \mod \left(Z ^ {N} - 1\right)
$$
in terms of the basis polynomials
$$
\hat {q} _ {j} (Z) f o r j = 0, \dots , N - 1
$$
where  $k(Z), u(Z)$  are defined as in Lemma 1 in terms of the basis polynomials corresponding to  $\mathbf{M}_1$  and  $\mathbf{M}_2$ , respectively, and  $(\hat{q}_j(Z))_{0 \leq j < N}$  corresponds to  $\mathbf{M}_0$ .
Proof. Follows from Propositions 1 and 2.
Now we give the class of matrices from which we can build a causal map. Specifically we prove a generalization of Theorem 3:
Theorem 8. Let  $n \geq 1$ , let  $N = \left\lceil \sqrt{2n} \right\rceil^2$ . Then define the basis polynomial  $\bar{q}_j(Z)$  to have minimum degree  $j$  and maximum degree  $n - 1$  for  $0 \leq j < n$ , and for  $n \leq j < N$ ,  $\bar{q}_j(Z)$  has minimum degree  $j$  and maximum degree  $N - 1$ .
For all  $\mathbf{M}_N$  with basis columns defined by  $(\bar{q}_j(Z))_{0\leq j < N}$  as above, the operation
$$
\mathbf {u} \mapsto \left(\mathbf {M} _ {N} ^ {- 1} \left(\mathbf {M} _ {N} \cdot (\mathbf {k}, \mathbf {0} _ {N - n}) \circ \mathbf {M} _ {N} \cdot (\mathbf {u}, \mathbf {0} _ {N - n})\right)\right) [ 0: n - 1 ] \tag {34}
$$
gives a causal map.
Proof. To prove this is causal means each entry,  $\mathbf{f}[i]$  is dependent only on  $\mathbf{u}[0],\mathbf{u}[1],\ldots \mathbf{u}[i]$ , where  $\mathbf{f} = \left(\mathbf{M}_N^{-1}\bigl (\mathbf{M}_N\cdot (\mathbf{k},\mathbf{0}_{N - n})\circ \mathbf{M}_N\cdot (\mathbf{u},\mathbf{0}_{N - n})\bigr)\right)$ . By Theorem 7, we have
$$
f (Z) = k (Z) \cdot u (Z) \mod (Z ^ {N} - 1),
$$
$$
k (Z) = \sum_ {j = 0} ^ {n - 1} k _ {j} \bar {q} _ {j} (Z) \quad u (Z) = \sum_ {j ^ {\prime} = 0} ^ {n - 1} u _ {j ^ {\prime}} \bar {q} _ {j ^ {\prime}} (Z).
$$
Since  $\deg (k(Z)\cdot u(Z))\leq 2n - 2\leq N - 2$  , this is equivalent to
$$
\begin{array}{l} f (Z) = k (Z) \cdot u (Z) \\ = \sum_ {j, j ^ {\prime} = 0} ^ {n - 1} k _ {j ^ {\prime}} \cdot u _ {j} \cdot \bar {q} _ {j ^ {\prime}} (Z) \cdot \bar {q} _ {j} (Z). \\ \end{array}
$$
By our choice of  $\bar{q}_j$ , we ensure that  $\bar{q}_j \cdot \bar{q}_{j'}$  has minimum degree  $j + j'$  and  $\deg (\bar{q}_j \cdot \bar{q}_{j'}) \leq 2n - 2 < N$  for any  $0 \leq j, j' < n$ . Then by Lemma 2 (see below), there exists coefficients  $\alpha_{j+j',i'}$  such that,
$$
\begin{array}{l} f (Z) = \sum_ {j, j ^ {\prime} = 0} ^ {n - 1} k _ {j ^ {\prime}} \cdot u _ {j} \cdot \sum_ {i ^ {\prime} = j + j ^ {\prime}} ^ {N - 1} \alpha_ {j + j ^ {\prime}, i ^ {\prime}} \cdot \bar {q} _ {i ^ {\prime}} (Z) \\ = \sum_{i = 0}^{N - 1}\left(\sum_{\substack{j,j^{\prime} = 0\\ j + j^{\prime}\leq i}}^{n - 1}\alpha_{j + j^{\prime},i}\cdot k_{j^{\prime}}\cdot u_{j})\right)\cdot \bar{q}_{i}(Z). \\ \end{array}
$$
If we define
$$
f (Z) = \sum_ {i = 0} ^ {N - 1} f _ {i} \cdot \bar {q} _ {i} (Z),
$$
then for  $0 \leq i < n$ , we get:
$$
f_{i} = \sum_{\substack{j,j^{\prime} = 0\\ j + j^{\prime}\leq i}}^{n - 1}\alpha_{j + j^{\prime},i}\cdot k_{j^{\prime}}\cdot u_{j}.
$$
Note that  $f_{i}$  only depends on  $\mathbf{u}[0],\mathbf{u}[1],\dots \mathbf{u}[i]$ , as desired.
We used the following lemma in the proof of Theorem 8.
Lemma 2. Let  $\bar{q}_j(Z)$  be defined as in Theorem 8. Then for any  $0\le j,j^{\prime} < n$
$$
\bar {q} _ {j} (Z) \cdot \bar {q} _ {j ^ {\prime}} (Z) = \sum_ {i = j + j ^ {\prime}} ^ {N - 1} \alpha_ {j + j ^ {\prime}, i} \cdot \bar {q} _ {i} (Z). \tag {35}
$$
for some set of coefficients  $\alpha_{j + j^{\prime},i}$
Proof. We first note that by our choice of  $\bar{q}_j$ , the minimum degree of  $\bar{q}_j(Z) \cdot \bar{q}_{j'}(Z)$  is  $j + j'$ , and  $\deg (\bar{q}_j(Z) \cdot \bar{q}_{j'}(Z)) \leq 2n - 2 \leq N - 1$ . Our claim follows from that fact that any polynomial  $p_d(Z)$  of minimum degree  $d$  and  $\deg (p_d) < N$  can be expressed as a linear combination of  $\bar{q}_d(Z), \bar{q}_{d+1}(Z), \ldots, \bar{q}_{N-1}(Z)$ .
D.3.3 Causal Monarch Convolutions
In this section we will prove Theorem 3. We will do so by showing that the basis polynomials  $q_{j}(Z)$  as defined in Theorem 3 are a special case of the basis polynomials  $\bar{q}_{j}(Z)$  as defined in Theorem 8.
Assumption 3. In this sub-section we will using block size  $b = \sqrt{N}$  therefore, we are dropping the block size from index notation. For example,  $(i_1, i_0)_{\sqrt{N}}$  becomes  $(i_1, i_0)$  for this section.
Assumption 4. Permutation matrices in this subsection are all the same  $\mathbf{P}_{(\sqrt{N}, N)}$  so we drop the subscript and just use  $\mathbf{P}$ .
Definition 5. Define
$$
q _ {\left(j _ {1}, j _ {0}\right)} ^ {\prime} (Z) \stackrel {\text {d e f}} {=} \ell_ {j _ {1}} (Z) \cdot r _ {j _ {1}, j _ {0}} \left(Z ^ {\sqrt {N}}\right). \tag {36}
$$
$\ell_{j_1}(Z)$  has minimum degree  $j_1$ , and  $r_{j_1,j_0}(Z)$  has minimum degree  $j_0$ . All polynomials  $q_{(j_1,j_0)}'(Z)$  have maximum degree  $\leq N - 1$ .
Next we argue that the above basis polynomials have a specific minimum degree.
Lemma 3. Polynomial  $q_{(j_1,j_0)}'(Z)$  as defined in equation (36) has minimum degree  $j_0\sqrt{N} + j_1$ .
Proof. We need to show that  $q_{(j_1,j_0)}'(Z)$  is a minimum degree  $j_0\sqrt{N} + j_1$  polynomial. Note that
$$
\begin{array}{l} q _ {(j _ {1}, j _ {0})} ^ {\prime} (Z) = \ell_ {j _ {1}} (Z) \cdot r _ {j _ {1}, j _ {0}} \left(Z ^ {\sqrt {N}}\right) \\ = Z ^ {\sqrt {N} - 1} \cdot \tilde {\ell} _ {\sqrt {N} - 1 - j _ {1}} \left(\frac {1}{Z}\right) \cdot Z ^ {(\sqrt {N} - 1) \cdot \sqrt {N}} \cdot \tilde {r} _ {\sqrt {N} - 1 - j _ {0}} \left(\frac {1}{Z ^ {\sqrt {N}}}\right) \\ \end{array}
$$
This claim can be shown using downward induction on  $d = N - 1, N - 2, \ldots$ .
where  $\tilde{\ell}_{\sqrt{N} -1 - j_1}(\cdot)$  has degree  $\sqrt{N} -1 - j_{1}$  and  $\tilde{r}_{\sqrt{N} -1 - j_0}(\cdot)$  has degree  $\sqrt{N} -1 - j_0$  . Simplifying we get
$$
q _ {(j _ {1}, j _ {0})} ^ {\prime} (Z) = Z ^ {N - 1} \cdot \tilde {\ell} _ {\sqrt {N} - 1 - j _ {1}} \left(\frac {1}{Z}\right) \cdot \tilde {r} _ {\sqrt {N} - 1 - j _ {0}} \left(\frac {1}{Z ^ {\sqrt {N}}}\right).
$$
This claim follows since  $\tilde{\ell}_{\sqrt{N} -1 - j_1}(Y)\cdot \tilde{r}_{j_1,j_0}\left(Y^{\sqrt{N}}\right)$  has degree  $= (\sqrt{N} -1 - j_{1}) + (\sqrt{N} -1-$ $j_0)\cdot \sqrt{N} = (N - 1) - (j_0\sqrt{N} +j_1).$
Note that the polynomial  $q_{(j_1,j_0)}'(Z)$  has minimum degree  $j_0\sqrt{N} + j_1$ . This is not  $j_1\sqrt{N} + j_0$  as in defined in equation (1), we will talk more about this soon.
Next, we observe that the polynomials in (36) define a matrix that satisfies (20).
Lemma 4. Let  $q_{(j_1,j_0)}'(Z)$  for  $0 \leq j_1\sqrt{N} + j_0 < n$  be as in (36). Define
$$
\mathbf {M} ^ {\prime} \left[ \left(i _ {1}, i _ {0}\right), \left(j _ {1}, j _ {0}\right) \right] = q _ {\left(j _ {1}, j _ {0}\right)} ^ {\prime} \left(\omega_ {N} ^ {i _ {1} \sqrt {N} + i _ {0}}\right).
$$
Then  $\mathbf{M}'$  satisfies (20).
Proof. If we evaluate the polynomials  $q_{(j_1,j_0)}'(Z)$  at  $\omega_N^i$  for  $0\leq i < N$ , we get
$$
q _ {\left(j _ {1}, j _ {0}\right)} \left(\omega_ {N} ^ {i}\right) = \ell_ {j _ {1}} \left(\omega_ {N} ^ {i}\right) \cdot r _ {j _ {1}, j _ {0}} \left(\omega_ {N} ^ {i \sqrt {N}}\right).
$$
Since  $\omega_N^{i\sqrt{N}} = \omega_N^{i_1N + i_0\sqrt{N}} = \omega_N^{i_0\sqrt{N}} = \omega_{\sqrt{N}}^{i_0}$ , we get
$$
\mathbf {M} ^ {\prime} \left[ \left(i _ {1}, i _ {0}\right), \left(j _ {1}, j _ {0}\right) \right] = \ell_ {j _ {1}} \left(\omega_ {N} ^ {i _ {1} \sqrt {N} + i _ {0}}\right) \cdot r _ {j _ {1}, j _ {0}} \left(\omega_ {\sqrt {N}} ^ {i _ {0}}\right).
$$
The above corresponds to how we define (20) since we have
$$
\mathbf {M} ^ {\prime} \left[ \left(i _ {1}, i _ {0}\right), \left(j _ {1}, j _ {0}\right) \right] = \overline {{\mathbf {L}}} _ {i _ {1}, j _ {1}} \left[ i _ {0}, i _ {0} \right] \cdot \mathbf {R} _ {j _ {1}, j _ {1}} \left[ i _ {0}, j _ {0} \right]
$$
$$
\overline {{\mathbf {L}}} _ {i _ {1}, j _ {1}} [ i _ {0}, i _ {0} ] = \ell_ {j _ {1}} \left(\omega_ {N} ^ {i _ {1} \sqrt {N} + i _ {0}}\right)
$$
$$
\mathbf {R} _ {j _ {1}, j _ {1}} \left[ i _ {0}, j _ {0} \right] = r _ {j _ {1}, j _ {0}} \left(\omega_ {\sqrt {N}} ^ {i _ {0}}\right).
$$
Recall from Lemma 3 that  $q_{(j_1,j_0)}'$  has minimum degree  $j_0\sqrt{N} + j_1$ . For causality we need  $q_{(j_1,j_0)}(Z)$  to have degree minimum  $j_1\sqrt{N} + j_0$  (then the polynomials will satisfy the minimum degree requirements from (1)). Therefore, we permute the columns of  $\mathbf{M}'$ ,
$$
\mathbf {M} = \mathbf {M} ^ {\prime} \cdot \mathbf {P} \tag {37}
$$
Note that the above  $\mathbf{M} = \mathbf{PLPRP}$  and is indeed a Monarch matrix as defined in Section 3.
Note that the basis polynomials of  $\mathbf{M}$  are defined as,
$$
q _ {\left(j _ {1}, j _ {0}\right)} (Z) = \ell_ {j _ {0}} (Z) \cdot \tilde {r} _ {j _ {0}, j _ {1}} \left(Z ^ {\sqrt {N}}\right). \tag {38}
$$
We note that the above is same as  $q_{j}(Z)$  defined in (5) where  $j = j_{1}\sqrt{N} + j_{0}$  with the correction in (5) that  $q_{j}(Z) = \ell_{m(j)} \cdot r_{j}(Z^{\sqrt{N}})$  where  $r_{j}(Y) = \tilde{r}_{j_{0},j_{1}}(Y)$ .
We are finally ready to prove Theorem 3.
Corollary 5 (Theorem 3 restated). Let  $N = \left\lceil \sqrt{2n} \right\rceil^2$ . Define  $\mathbf{M}_N$  by  $q_{(j_1,j_0)}$  as in (38). Then,
$$
\mathbf {u} \mapsto \left(\mathbf {M} _ {N} ^ {- 1} \left(\mathbf {M} _ {N} \cdot (\mathbf {k}, \mathbf {0} _ {N - n}) \circ \mathbf {M} _ {N} \cdot (\mathbf {u}, \mathbf {0} _ {N - n})\right)\right) [ 0: n - 1 ]
$$
givesa causal map.
Proof. Due to using  $q$  polynomials as in (38), by Lemma 3 the degree of the  $(j_1, j_0)^{\mathrm{th}}$  column is a polynomial with minimum degree  $j_1\sqrt{N} + j_0$ . This implies that these basis polynomials are a subset of the more general causal maps in Theorem 8, which proves the claim.
It can also be verified that  $q_{(j_1,j_0)}$  has maximum degree  $\leq N - 1$ .
D.4 Block Algorithms for Complex Numbers and Block Size  $\sqrt{N}$
In the following subsections we restate the results in Section D.3.3 in terms of block operations. As mentioned earlier, this is so that we can do computations on Monarch matrices using only GEMM operations (and simple data movement operations like permutations).
In Appendix D.4.1 we consider arbitrary Monarch matrices and in Appendix D.4.2 we consider the sub-class of Monarch matrices corresponding to Theorem 3.
D.4.1 General Block Monarch Convolution
In this subsection we re-state general Monarch convolutions in terms of block operations.
Recall from equation (22) we defined the block diagonal matrix  $\mathbf{R}$  as follows  $(0\leq i_0,j_1,j_0 <   \sqrt{N})$  ..
$$
\mathbf {R} _ {j _ {1}, j _ {1}} \left[ i _ {0}, j _ {0} \right] \leftarrow \tilde {r} _ {j _ {1}, j _ {0}} \left(\omega_ {\sqrt {N}} ^ {i _ {0}}\right), \tag {39}
$$
where  $\deg (\tilde{r}_{j_1,j_0}) < \sqrt{N}$ .
To do so, we will first work with  $\mathbf{M}_N^{\prime}$  such that  $\mathbf{M}_N = \mathbf{M}_N^{\prime} \cdot \mathbf{P}$ . We want to express Monarch matrices,  $\mathbf{M}_N$ , as univariate polynomial evaluation over  $\{1, \omega_N, \dots, \omega_N^{N-1}\}$ . Towards that end, define
$$
r _ {j _ {1}, j _ {0}} (Z) = \tilde {r} _ {j _ {1}, j _ {0}} \left(Z ^ {\sqrt {N}}\right).
$$
By simple observation that  $\omega_N^{(i_1\sqrt{N} +i_0)\sqrt{N}} = \omega_N^{i_0\sqrt{N}} = \omega_{\sqrt{N}}^{i_0}$ , we have
$$
r _ {j _ {1}, j _ {0}} \left(\omega_ {N} ^ {i _ {1} \sqrt {N} + i _ {0}}\right) = \tilde {r} _ {j _ {1}, j _ {0}} \left(\omega_ {\sqrt {N}} ^ {i _ {0}}\right).
$$
In other words we have,
$$
\mathbf {R} _ {j _ {1}, j _ {1}} [ i _ {0}, j _ {0} ] = r _ {j _ {1}, j _ {0}} \left(\omega_ {N} ^ {i}\right).
$$
Fix  $0 \leq j_{1}, j_{0} < \sqrt{N}$  so we're looking at the  $j_{0}^{th}$  column of block  $\mathbf{R}_{j_{1},j_{1}}$ , going down the column we evaluate the polynomial  $\tilde{r}_{j_{1},j_{0}}$  at points  $\left(1, \omega_{\sqrt{N}}, \ldots, \omega_{\sqrt{N}-1}\right)$ . Which is equivalent to a matrix multiplication of Fourier matrix of size  $\sqrt{N}$  and a matrix of the coefficients of the  $\tilde{r}$  polynomials.
So we can think of the blocks of  $\mathbf{R}$  as a Fourier matrix times a coefficient matrix. In other words, let us define a matrix  $\widetilde{\mathbf{R}}\in \mathbb{R}^{N\times \sqrt{N}}$  which will hold  $\sqrt{N}$  coefficient blocks  $\widetilde{\mathbf{R}}_0,\widetilde{\mathbf{R}}_1,\ldots \widetilde{\mathbf{R}}_{\sqrt{N} -1}\in$ $\mathbb{R}^{\sqrt{N}\times \sqrt{N}}$  such that,
$$
\tilde {\mathbf {R}} _ {j _ {1}} [ a, j _ {0} ] = \tilde {r} _ {j _ {1}, j _ {0}} [ a ],
$$
$$
\tilde {r} _ {j _ {1}, j _ {0}} (Y) = \sum_ {a = 0} ^ {\sqrt {N} - 1} \tilde {r} _ {j _ {1}, j _ {0}} [ a ] \cdot Y ^ {a}.
$$
Then we define
$$
\mathbf {R} _ {j _ {1}, j _ {1}} = \mathbf {F} _ {\sqrt {N}} \cdot \widetilde {\mathbf {R}} _ {j _ {1}}.
$$
Next, we restate the above as product of two block diagonal matrices:
In other words, we have
$$
\mathbf {R} = \operatorname {d i a g} \underbrace {\left(\mathbf {F} _ {\sqrt {N}} , \dots , \mathbf {F} _ {\sqrt {N}}\right)} _ {\sqrt {N} \text {t i m e s}} \cdot \operatorname {d i a g} \left(\widetilde {\mathbf {R}} _ {0}, \dots , \widetilde {\mathbf {R}} _ {\sqrt {N} - 1}\right). \tag {40}
$$
Equation (21) defined  $\mathbf{L}$  as evaluation of bivariate polynomials. We now wish to do the same with univariate polynomials.
Recall that  $\overline{\mathbf{L}} = \mathbf{PLP}$ . We define the  $i_0^{th}$  diagonal block  $(0\leq i_{1},i_{0},j_{1} < \sqrt{N})$  for  $\mathbf{L}$  as:
$$
\mathbf {L} _ {i _ {0}, i _ {0}} \left[ i _ {1}, j _ {1} \right] = \ell_ {j _ {1}} \left(\omega_ {N} ^ {i _ {0} \sqrt {N} + i _ {1}}\right), \tag {41}
$$
where  $\deg (\ell_{j_1}) < N$ .
Let us define a matrix  $\widetilde{\mathbf{L}}\in \mathbb{R}^{N\times \sqrt{N}}$  that will hold the coefficients of polynomials  $\ell_{j_1}(Z)$  i.e.
$$
\widetilde {\mathbf {L}} [ a, j _ {1} ] = \tilde {\ell} _ {j _ {1}} [ a ]
$$
$$
\ell_ {j _ {1}} (Z) = \sum_ {a = 0} ^ {N - 1} \tilde {\ell} _ {j _ {1}} [ a ] \cdot Z ^ {a}.
$$
We can multiply this matrix with the Fourier matrix of size  $N \times N$  to get the blocks of  $\mathbf{L}$  (which we will need to diagonalize). Specifically define
$$
\mathbf {L} ^ {\prime \prime} = \mathbf {F} _ {N} \cdot \widetilde {\mathbf {L}}.
$$
The rows of  $\mathbf{L}''$  and the rows of  $\mathbf{M}'$  are both indexed by  $i$ . Meaning they're ordered in lexicographic ordering  $(i_1, i_0)$ , which is a problem for the following reason. The block diagonal matrix  $\mathbf{L}$  made from  $\mathbf{L}''$  needs to be in lexicographic ordering  $(i_0, i_1)$  (see (41)) since it gets permuted on the left  $\mathbf{M} = \mathbf{PLP}$  and right allowing  $\mathbf{M}$  to be ordered by  $(i_1, i_0)$ . Therefore, when composing  $\mathbf{L}$  from  $\mathbf{L}''$  we must permute the rows by  $\mathbf{P}$ . So we get,
$$
\mathbf {L} ^ {\prime} = \mathbf {P} \cdot \mathbf {L} ^ {\prime \prime}.
$$
$$
\mathbf {L} ^ {\prime} = \left[ \begin{array}{c} \mathbf {L} _ {0} ^ {\prime} \\ \vdots \\ \mathbf {L} _ {\sqrt {N} - 1} ^ {\prime} \end{array} \right].
$$
$$
\mathbf {L} = \operatorname {d i a g} \left(\mathbf {L} _ {0} ^ {\prime}, \dots \mathbf {L} _ {\sqrt {N} - 1} ^ {\prime}\right). \tag {42}
$$
Pictorially:
Let  $f$  be the function that maps coefficient matrices  $\widetilde{\mathbf{L}},\widetilde{\mathbf{R}}\in \mathbb{R}^{N\times \sqrt{N}}$  to  $(\mathbf{L},\mathbf{R})$  where  $\mathbf{L}$  and  $\mathbf{R}$  are defined by (42) and (40).
Theorem 9. Let  $f$  be as defined above. Then  $f$  is a bijection.
Proof. To prove  $f$  is a bijection we must show  $f$  is one-to-one and  $f^{-1}$  is one-to-one (and exists).
To show  $f$  is one-to-one means both  $\widetilde{\mathbf{L}}$  and  $\widetilde{\mathbf{R}}$  given to  $f$  will output a unique pair  $(\mathbf{L},\mathbf{R})$ . This follows from (42) and (40), and the fact that polynomial evaluation is a function.
Now to show  $f^{-1}$  exists and is one-to-one, we must show that there's a map for any  $(\mathbf{L},\mathbf{R})$  to unique  $\widetilde{\mathbf{L}},\widetilde{\mathbf{R}}\in \mathbb{R}^{N\times \sqrt{N}}$ . Then for any pair  $(\mathbf{L},\mathbf{R})$  where both  $\mathbf{L}$  and  $\mathbf{R}$  are block diagonal matrices, there's a map to unique sets of polynomials,  $\ell ,\tilde{r}$  where each coefficient is an entry of  $\widetilde{\mathbf{L}},\widetilde{\mathbf{R}}$  (thus giving a unique mapping from  $(\mathbf{L},\mathbf{R})$ 's to  $(\widetilde{\mathbf{L}},\widetilde{\mathbf{R}})$ 's).
We need to show the existence of  $\ell_{j_1}(Z)$  and  $\tilde{r}_{j_1,j_0}(Y)$  such that:
$$
\mathbf {L} _ {i _ {0}, i _ {0}} [ i _ {1}, j _ {1} ] = \ell_ {j _ {1}} \left(\omega_ {N} ^ {i _ {0} \sqrt {N} + i _ {1}}\right)
$$
$$
\mathbf {R} _ {j _ {1}, j _ {1}} [ i _ {0}, j _ {0} ] = \tilde {r} _ {j _ {1}, j _ {0}} (\omega_ {\sqrt {N}} ^ {i _ {0}}).
$$
Fix  $0 \leq j_{1}, j_{0} < \sqrt{N}$ . Then consider the values  $0 \leq i_{0} < \sqrt{N}$ :
$$
y _ {i _ {0}} \leftarrow \mathbf {R} _ {j _ {1}, j _ {1}} [ i _ {0}, j _ {0} ].
$$
Then by Theorem 4 there exists a unique polynomial of degree  $< \sqrt{N}$  (call it  $\tilde{r}_{j_1,j_0}$ ) such that for all  $0\leq i_0 < \sqrt{N}$ :
$$
\tilde {r} _ {j _ {1}, j _ {0}} \left(\omega_ {\sqrt {N}} ^ {i _ {0}}\right) = y _ {i _ {0}}.
$$
There will be  $N$  polynomials with  $\sqrt{N}$  coefficients each, meaning there's a unique set of coefficients to make up the indices of  $\widetilde{\mathbf{R}}$ .
Now to get the entries of  $\widetilde{\mathbf{L}}$  from  $\mathbf{L}$ , fix  $0 \leq j_{1} < \sqrt{N}$ . Then consider the values  $0 \leq i_{1}, i_{0} < \sqrt{N}$ :
$$
y _ {i _ {1}, i _ {0}} \leftarrow \mathbf {L} _ {i _ {0}, i _ {0}} [ i _ {1}, j _ {1} ].
$$
Then by Theorem 4 there exists a unique polynomial of degree  $< N$  (call it  $\ell_{j_1}$ ) such that for all  $0 \leq i_1, i_0 < \sqrt{N}$ :
$$
\ell_ {j _ {1}} \left(\omega_ {N} ^ {i _ {0} \sqrt {N} + i _ {1}}\right) = y _ {i _ {1}, i _ {0}}.
$$
There will be  $\sqrt{N}$  polynomials with  $N$  coefficients each, meaning there's a unique set of coefficients to make up the indices of  $\widetilde{\mathbf{L}}$ .
Algorithm 2 is pseudo code for the map from  $\widetilde{\mathbf{L}},\widetilde{\mathbf{R}}\in \mathbb{R}^{N\times \sqrt{N}}$  to block diagonal matrices  $\mathbf{L},\mathbf{R}$
Algorithm 2 BLOCKY MONARCH( $\widetilde{\mathbf{L}}, \widetilde{\mathbf{R}}$ )
Input:  $\widetilde{\mathbf{L}},\widetilde{\mathbf{R}}\in \mathbb{R}^{N\times \sqrt{N}}$
Output: Block diagonal matrices  $\mathbf{L},\mathbf{R}\in \mathbb{C}^{N\times N}$
1: Let  $\mathbf{F}_N$  be the Fourier transform Monarch matrix  $\mathbf{PL}_F\mathbf{PR}_F\mathbf{P}$
2:  $\mathbf{L}' \leftarrow \mathbf{P} \cdot \mathbf{F}_N \cdot \widetilde{\mathbf{L}}$
3: for  $a \gets 0$  to  $\sqrt{N} - 1$  do
4: \(\mathbf{L}_a^\prime \gets \mathbf{L}^\prime [a\sqrt{N}:a\sqrt{N} +\sqrt{N} -1,:\]
5:  $\mathbf{L}\gets \mathrm{diag}(\mathbf{L}_0^{\prime},\dots \mathbf{L}_{\sqrt{N} -1}^{\prime})$
6: for  $a \gets 0$  to  $\sqrt{N} - 1$  do
7: \(\mathbf{R}_a\gets \mathbf{F}_{\sqrt{N}}\cdot \bar{\mathbf{R}} [a\sqrt{N}:a\sqrt{N} +\sqrt{N} -1,:\]
8:  $\mathbf{R} \gets \mathrm{diag}\left(\mathbf{R}_0, \dots, \mathbf{R}_{\sqrt{N} - 1}\right)$
9: return  $\overline{\mathbf{L}},\mathbf{R}$
$\triangleright$  First, compute  $\mathbf{L}$  from  $\widetilde{\mathbf{L}}$
See Corollary 6
Now compute  $\mathbf{R}$  from  $\widetilde{\mathbf{R}}$
Lemma 5. Algorithm 2 uses  $O(N^{3/2})$  FLOPs and  $3\sqrt{N}$  GEMMs of two  $\sqrt{N} \times \sqrt{N}$  matrices.
Proof. Lines 1 and 2 are multiplying a monarch matrix representing the Fourier transform times a  $N \times \sqrt{N}$  matrix in block fashion again, giving  $O(N^{3/2})$  FLOPs.
Similarly, lines 6 and 7 have two  $\sqrt{N}$  matrices multiplied  $\sqrt{N}$  times. Giving  $O(N^{3/2})$  FLOPs.
Lines 3, 4, 5, 8, and 9 don't count towards FLOPs
Therefore we have  $O(N^{3/2})$  FLOPS and  $3\sqrt{N}$  GEMMs of two  $\sqrt{N} \times \sqrt{N}$  matrices.
Now that we have the operations in terms of blocks, we will make them causal in the following sub-section.
D.4.2 Causal Block Monarch Convolution
Recall that a Monarch matrix is defined as
$$
\mathbf {M} = \mathbf {P L P R P},
$$
then per equation (37) we have
$$
\mathbf {M} ^ {\prime} = \mathbf {P L P R}. \tag {43}
$$
Then if  $q_{(j_1,j_0)}(Z)$  is the basis polynomial corresponding to the  $(j_{1},j_{0})^{th}$  column of  $\mathbf{M}$ , by (38) the basis polynomial corresponding to  $\mathbf{M}$  is
$$
q _ {\left(j _ {1}, j _ {0}\right)} (Z) = \ell_ {j _ {0}} (Z) \cdot \tilde {r} _ {j _ {0}, j _ {1}} \left(Z ^ {\sqrt {N}}\right) \tag {44}
$$
with the minimum degree of  $j_{1}\sqrt{N} + j_{0}$  (recall that we pick  $\ell_{j_{0}}$  and  $\tilde{r}_{j_{0},j_{1}}$  to have minimum degree  $j_{0}$  and  $j_{1}$  respectively) as desired.
Theorem 10. Let  $\mathbf{L},\mathbf{R}\gets$  BLOCKY MONARCH(L,  $\widetilde{\mathbf{R}}$  ). Let  $\mathbf{M}$  be as in (37). Then for every  $0\leq i$ $j < N$  , we have:
$$
\mathbf {M} [ (i _ {1}, i _ {0}), (j _ {1}, j _ {0}) ] = q _ {(j _ {1}, j _ {0})} \left(\omega_ {N} ^ {i _ {1} \sqrt {N} + i _ {0}}\right),
$$
where  $q_{(j_1,j_0)}$  is as in (44).
Proof. To prove this we need to show the  $(j_1, j_0)^{th}$  column of  $\mathbf{M}$  is the basis polynomial  $q_{(j_1, j_0)}$  evaluated at the  $N^{th}$  roots of unity, where  $q_{(j_1, j_0)}$  is as defined in (44). Note we have