(MCA) of the U-gates to generate the rotation matrices (see Fig. 3b of the
paper), (_ii_) PSs and tunable optical attenuators and amplifiers to generate
the terms $\alpha_{0}$ and $i\alpha_{1,2,3}$, and (_iii_) fan-in and fan-out
gates to obtain the linear combination of all terms (see Supplementary Note 3
for more details about these multi-anbit gates). As seen, this structure is
more complex than the architecture of an M-gate based on the SVD (Fig. 3c)
given that it involves a higher number of basic devices, requires ancilla
anbits and generates gargabe anbits.

Supplementary Figure 7. Optical circuit of an M-gate based on the
factorization described by Supplementary Equation 62. The gates fan-in (FI)
and fan-out (FO) are described in Fig. 5a of the main text and in
Supplementary Note 3, see p. Supplementary Note 3: sequential design.

### 2.3 Controlled gates

In any computation theory, a controlled gate is an operation of _multiple_
units of information given that the goal is to perform a transformation on the
target units of information (e.g. the target anbits,
$\bigl{|}t\bigr{\rangle}$) depending on the value of the control units of
information (e.g. the control anbits, $\bigl{|}c\bigr{\rangle}$).

In APC, the definition of a multi-anbit gate (in this case, a controlled gate)
will depend on the kind of operation employed to describe the multiple input
and output anbits. As commented in the main text, using the _tensor product_
to describe $\bigl{|}t\bigr{\rangle}$ and $\bigl{|}c\bigr{\rangle}$, the
mathematical framework of a controlled anbit gate can be directly extrapolated
from a controlled quantum gate (but differing in some fundamental aspects).

Here, we develop in detail the theory of such a kind of gates within the
context of APC highlighting the main differences with QC.

#### 2.3.1 Single control anbit

##### Definition and formalism.

Let us start by considering a single-anbit linear gate (a U-, G-, or M-gate)
performing a transformation $\widehat{\mathrm{F}}$ on an input anbit
$\bigl{|}t\bigr{\rangle}$: the target anbit. The controlled version of the
$\widehat{\mathrm{F}}$-gate (termed as controlled-$\widehat{\mathrm{F}}$ gate)
with a single control anbit
$\bigl{|}c\bigr{\rangle}\in\left\\{\bigl{|}0\bigr{\rangle},\bigl{|}1\bigr{\rangle}\right\\}$
is a linear operator $\widehat{\mathrm{F}}_{\mathrm{C}}$ defined via the
tensor product as:

$\widehat{\mathrm{F}}_{\mathrm{C}}:=\widehat{\mathrm{1}}\otimes\widehat{\mathrm{F}}^{c},$
(63)

which transforms the input $\bigl{|}c,t\bigr{\rangle}$ into the output:

$\widehat{\mathrm{F}}_{\mathrm{C}}\bigl{|}c,t\bigr{\rangle}=\bigl{(}\widehat{\mathrm{1}}\otimes\widehat{\mathrm{F}}^{c}\bigr{)}\bigl{|}c,t\bigr{\rangle}=\bigl{|}c\bigr{\rangle}\otimes\widehat{\mathrm{F}}^{c}\bigl{|}t\bigr{\rangle}.$
(64)

The transformation $\widehat{\mathrm{F}}$ is applied to
$\bigl{|}t\bigr{\rangle}$ when
$\bigl{|}c\bigr{\rangle}=\bigl{|}1\bigr{\rangle}$ or, otherwise,
$\bigl{|}t\bigr{\rangle}$ remains invariant at the output. Figure 4a of the
paper shows the symbolic representation of
$\widehat{\mathrm{F}}_{\mathrm{C}}$, the same as that of a controlled quantum
gate for the sake of simplicity. However, in contrast to QC,
$\widehat{\mathrm{F}}_{\mathrm{C}}$ will be a non-unitary operation when
$\widehat{\mathrm{F}}\widehat{\mathrm{F}}^{\dagger}\neq\widehat{1}$, that is,
when $\widehat{\mathrm{F}}$ is a G- or M-gate (see below the algebraic
structure in properties).

In any case, the mathematical formalism of a controlled anbit gate is the same
as that of a controlled quantum gate. Since we work with two input and output
anbits, the underlying Hilbert space is
$\mathscr{E}_{2}=\mathscr{E}_{1}\otimes\mathscr{E}_{1}$ and the canonical
(orthonormal) basis is given by Supplementary Equation 24, reproduced here for
clarity:

$\mathcal{B}_{2}=\left\\{\bigl{|}k\bigr{\rangle}\otimes\bigl{|}l\bigr{\rangle}\right\\}_{k,l\in\left\\{0,1\right\\}}=\left\\{\bigl{|}0,0\bigr{\rangle},\bigl{|}0,1\bigr{\rangle},\bigl{|}1,0\bigr{\rangle},\bigl{|}1,1\bigr{\rangle}\right\\}.$
(65)

Hence, the matrix representation of $\widehat{\mathrm{F}}_{\mathrm{C}}$
associated to $\mathcal{B}_{2}$ is:

$\displaystyle F_{\mathrm{C}}$
$\displaystyle=M_{\mathcal{B}_{2}}^{\mathcal{B}_{2}}\bigl{(}\widehat{\mathrm{F}}_{\mathrm{C}}\bigr{)}=\bigl{(}\begin{array}[]{ccc}\cdots&\bigl{[}\widehat{\mathrm{F}}_{\mathrm{C}}\bigl{|}k,l\bigr{\rangle}\bigr{]}_{\mathcal{B}_{2}}&\cdots\end{array}\bigr{)}=\left(\begin{array}[]{c|c}I&0\\\
\hline\cr 0&F\end{array}\right),$ (69)

where $F_{\mathrm{C}}\in M_{4}\left(\mathbb{C}\right)$, $I$ is the $2\times 2$
identity matrix and $F\in M_{2}\left(\mathbb{C}\right)$ is the matrix
representation of $\widehat{\mathrm{F}}$ associated to the canonical basis
$\mathcal{B}_{1}=\left\\{\left|0\right\rangle,\left|1\right\rangle\right\\}$
of $\mathscr{E}_{1}$, see Supplementary Equation 36. Along this line, the ket-
bra representation of $\widehat{\mathrm{F}}_{\mathrm{C}}$ can be calculated
from the entries of $F_{\mathrm{C}}$ as follows (see previously p. Ket-bra
representation., where the ket-bra representation of a gate is introduced):

$\displaystyle\widehat{\mathrm{F}}_{\mathrm{C}}$
$\displaystyle=\bigl{|}0,0\bigr{\rangle}\bigl{\langle}0,0\bigr{|}+\bigl{|}0,1\bigr{\rangle}\bigl{\langle}0,1\bigr{|}$
$\displaystyle+F_{00}\bigl{|}1,0\bigr{\rangle}\bigl{\langle}1,0\bigr{|}+F_{01}\bigl{|}1,0\bigr{\rangle}\bigl{\langle}1,1\bigr{|}+F_{10}\bigl{|}1,1\bigr{\rangle}\bigl{\langle}1,0\bigr{|}+F_{11}\bigl{|}1,1\bigr{\rangle}\bigl{\langle}1,1\bigr{|}$
$\displaystyle=\bigl{|}0\bigr{\rangle}\bigl{\langle}0\bigr{|}\otimes\left(\bigl{|}0\bigr{\rangle}\bigl{\langle}0\bigr{|}+\bigl{|}1\bigr{\rangle}\bigl{\langle}1\bigr{|}\right)$
$\displaystyle+\bigl{|}1\bigr{\rangle}\bigl{\langle}1\bigr{|}\otimes\left(F_{00}\bigl{|}0\bigr{\rangle}\bigl{\langle}0\bigr{|}+F_{01}\bigl{|}0\bigr{\rangle}\bigl{\langle}1\bigr{|}+F_{10}\bigl{|}1\bigr{\rangle}\bigl{\langle}0\bigr{|}+F_{11}\bigl{|}1\bigr{\rangle}\bigl{\langle}1\bigr{|}\right)$
$\displaystyle=\bigl{|}0\bigr{\rangle}\bigl{\langle}0\bigr{|}\otimes\widehat{1}+\bigl{|}1\bigr{\rangle}\bigl{\langle}1\bigr{|}\otimes\widehat{\mathrm{F}}.$
(70)

In contrast to Supplementary Equation 63, the ket-bra representation of
$\widehat{\mathrm{F}}_{\mathrm{C}}$ can be applied to an arbitrary control
anbit
$\bigl{|}c\bigr{\rangle}=c_{0}\bigl{|}0\bigr{\rangle}+c_{1}\bigl{|}1\bigr{\rangle}\notin\left\\{\bigl{|}0\bigr{\rangle},\bigl{|}1\bigr{\rangle}\right\\}$.
In such a scenario, using Supplementary Equation 70,
$\widehat{\mathrm{F}}_{\mathrm{C}}$ generates the output:

$\widehat{\mathrm{F}}_{\mathrm{C}}\bigl{|}c,t\bigr{\rangle}=\bigl{\langle}0|c\bigr{\rangle}\bigl{|}0,t\bigr{\rangle}+\bigl{\langle}1|c\bigr{\rangle}\bigl{|}1\bigr{\rangle}\otimes\widehat{\mathrm{F}}\bigl{|}t\bigr{\rangle}=c_{0}\bigl{|}0,t\bigr{\rangle}+c_{1}\bigl{|}1\bigr{\rangle}\otimes\widehat{\mathrm{F}}\bigl{|}t\bigr{\rangle}.$
(71)

Note that this input-output relation is more general than Supplementary
Equation 64.

On the other hand, although it is out of the scope of this work, it is worthy
to note that a controlled anbit gate can alternatively be defined by using the
_Cartesian product_. This possibility cannot be found in QC. Nevertheless,
using the Cartesian product we cannot extrapolate the mathematical framework
of the controlled quantum gates to the controlled anbit gates. In any case,
for completeness, let us discuss this possibility. Here, the basic idea is to
define a controlled anbit gate as follows: the transformation
$\widehat{\mathrm{F}}$ is applied to $\bigl{|}t\bigr{\rangle}$ when
$\bigl{|}c\bigr{\rangle}$ is the null anbit $\bigl{|}\mathbf{0}\bigr{\rangle}$
or, otherwise, $\bigl{|}t\bigr{\rangle}$ remains invariant at the output. In
this way, using this definition and the canonical vector basis of
$\mathscr{E}_{2}=\mathscr{E}_{1}\times\mathscr{E}_{1}$, given by Supplementary
Equation 32, it is straightforward to demonstrate that we obtain the same
matrix representation of $\widehat{\mathrm{F}}_{\mathrm{C}}$ as in
Supplementary Equation 69.

##### Properties.

The controlled anbit gate illustrated in Fig. 4a of the main text exhibits the
following properties:

  1. 1.

_Endomorphism_. The linear operator $\widehat{\mathrm{F}}_{\mathrm{C}}$ is an
endomorphism of the Hilbert space
$\mathscr{E}_{2}=\mathscr{E}_{1}\otimes\mathscr{E}_{1}$.

  2. 2.

_EDF transformation_. If $\bigl{|}c\bigr{\rangle}=\bigl{|}1\bigr{\rangle}$,
then $\widehat{\mathrm{F}}_{\mathrm{C}}$ modifies the EDFs of
$\bigl{|}t\bigr{\rangle}$ according to $\widehat{\mathrm{F}}$ (a U-, G-, or
M-gate). For instance, assuming a target anbit with 3 EDFs, if
$\bigl{|}c\bigr{\rangle}=\bigl{|}1\bigr{\rangle}$ and $\widehat{\mathrm{F}}$
is a U-gate, then $\widehat{\mathrm{F}}_{\mathrm{C}}$ transforms these EDFs by
rotating $\bigl{|}t\bigr{\rangle}$ in the GBS.

  3. 3.

_Reversibility_. From Supplementary Equation 69, it is direct to verify that:

$\det\bigl{(}F_{\mathrm{C}}\bigr{)}=\det\bigl{(}F\bigr{)}.$ (72)

Consequently, the controlled-$\widehat{\mathrm{F}}$ gate is reversible if and
only if the $\widehat{\mathrm{F}}$-gate is reversible
($\det\bigl{(}F\bigr{)}\neq 0$). In such a case,
$\widehat{\mathrm{F}}_{\mathrm{C}}$ is an automorphism. The inverse controlled
gate (inverse automorphism) is described by the linear operator
$\widehat{\mathrm{F}}_{\mathrm{C}}^{-1}$, whose matrix representation
associated to $\mathcal{B}_{2}$ is:

$\displaystyle F_{\mathrm{C}}^{-1}$
$\displaystyle=M_{\mathcal{B}_{2}}^{\mathcal{B}_{2}}\bigl{(}\widehat{\mathrm{F}}_{\mathrm{C}}^{-1}\bigr{)}=\bigl{[}M_{\mathcal{B}_{2}}^{\mathcal{B}_{2}}\bigl{(}\widehat{\mathrm{F}}_{\mathrm{C}}\bigr{)}\bigr{]}^{-1}=\left(\begin{array}[]{c|c}I&0\\\
\hline\cr 0&F^{-1}\end{array}\right).$ (75)

In addition, if the controlled-$\widehat{\mathrm{F}}$ gate is reversible, then
$\widehat{\mathrm{F}}_{\mathrm{C}}\bigl{(}\mathcal{B}_{2}\bigr{)}=\bigl{\\{}\widehat{\mathrm{F}}_{\mathrm{C}}\bigl{|}k,l\bigr{\rangle}\bigr{\\}}_{k,l\in\left\\{0,1\right\\}}$
is a vector basis of $\mathscr{E}_{2}$. Using the contrapositive statement, if
$\widehat{\mathrm{F}}_{\mathrm{C}}\bigl{(}\mathcal{B}_{2}\bigr{)}$ is not a
vector basis of $\mathscr{E}_{2}$, then it follows that the
controlled-$\widehat{\mathrm{F}}$ gate is irreversible.

  4. 4.

_Matrix factorizations_. Any matrix factorization of $F$ can be directly
applied to $F_{\mathrm{C}}$:

$F_{\mathrm{C}}=\left(\begin{array}[]{c|c}I&0\\\ \hline\cr
0&F\end{array}\right)=\left(\begin{array}[]{c|c}I&0\\\ \hline\cr
0&\prod_{k}F_{k}\end{array}\right)=\prod_{k}\left(\begin{array}[]{c|c}I&0\\\
\hline\cr 0&F_{k}\end{array}\right).$ (76)

In other words, if the $\widehat{\mathrm{F}}$-gate is equivalent to a set of
$\widehat{\mathrm{F}}_{k}$-gates connected in series, then the
controlled-$\widehat{\mathrm{F}}$ gate is equivalent to a set of
controlled-$\widehat{\mathrm{F}}_{k}$ gates connected in series.

  5. 5.

_Algebraic structure_. The matrix $F_{\mathrm{C}}$ inherits the algebraic
structure of $F$: if $F\in\mathrm{U}\left(2\right)$, then
$F_{\mathrm{C}}\in\mathrm{U}\left(4\right)$; if
$F\in\mathrm{GL}\left(2,\mathbb{C}\right)$, then
$F_{\mathrm{C}}\in\mathrm{GL}\left(4,\mathbb{C}\right)$; if
$F\in\mathfrak{gl}\left(2,\mathbb{C}\right)$, then
$F_{\mathrm{C}}\in\mathfrak{gl}\left(4,\mathbb{C}\right)$ (the definition of
the Lie groups $\mathrm{U}\left(n\right)$ and
$\mathrm{GL}\left(n,\mathbb{C}\right)$, and the Lie algebra
$\mathfrak{gl}\left(n,\mathbb{C}\right)$ is detailed in ref. [21]). Note that
in QC, $F_{\mathrm{C}}$ can only belong to $\mathrm{U}\left(4\right)$.

  6. 6.

_Universality_. A universal matrix of a controlled-$\widehat{\mathrm{F}}$ gate
must be able to describe all the possible $4\times 4$ matrix transformations
of the form given by Supplementary Equation 69. Therefore, $F_{\mathrm{C}}$ is
a universal matrix of a controlled-$\widehat{\mathrm{F}}$ gate if and only if
$F$ is a universal matrix of a U-, G-, or M-gate.

  7. 7.

_PIP implementation_. In QC, the theoretical strategies to design controlled
gates are focused on factorizing $F_{\mathrm{C}}$ as a function of single-
qubit gates and the controlled-NOT (CNOT) gate [22]. Despite the fact that
these schemes could be extrapolated to APC, the implementation of a controlled
anbit gate using PIP technology does not require these intricate design
strategies. Remarkably, _APC has its own design strategies_ _and
architectures_ , as demonstrated in Figs. 4b, 4c and 4d of the paper.

#### 2.3.2 Multiple control anbits

##### Definition and formalism.

Consider a single-anbit $\widehat{\mathrm{F}}$-gate (a U-, G-, or M-gate)
operating on a target anbit $\bigl{|}t\bigr{\rangle}$. The
controlled-$\widehat{\mathrm{F}}$ gate with $n$ control anbits
$\bigl{|}c_{1,2,\ldots,n}\bigr{\rangle}\in\left\\{\bigl{|}0\bigr{\rangle},\bigl{|}1\bigr{\rangle}\right\\}$
is a linear operator $\widehat{\mathrm{F}}_{\mathrm{C}}$ defined as:

$\widehat{\mathrm{F}}_{\mathrm{C}}:=\underset{n-1\textrm{
times}}{\underbrace{\widehat{\mathrm{1}}\otimes\ldots\otimes\widehat{\mathrm{1}}}}\otimes\widehat{\mathrm{F}}^{c_{1}c_{2}\ldots
c_{n}}=\widehat{\mathrm{1}}^{\otimes\left(n-1\right)}\otimes\widehat{\mathrm{F}}^{c_{1}c_{2}\ldots
c_{n}},$ (77)

which transforms the input
$\bigl{|}c_{1},c_{2},\ldots,c_{n}\bigr{\rangle}\otimes\bigl{|}t\bigr{\rangle}$
into the output:

$\widehat{\mathrm{F}}_{\mathrm{C}}\bigl{(}\bigl{|}c_{1},c_{2},\ldots,c_{n}\bigr{\rangle}\otimes\bigl{|}t\bigr{\rangle}\bigr{)}=\bigl{|}c_{1},c_{2},\ldots,c_{n}\bigr{\rangle}\otimes\widehat{\mathrm{F}}^{c_{1}c_{2}\ldots
c_{n}}\bigl{|}t\bigr{\rangle}.$ (78)

The transformation $\widehat{\mathrm{F}}$ is applied to
$\bigl{|}t\bigr{\rangle}$ when
$\bigl{|}c_{1},c_{2},\ldots,c_{n}\bigr{\rangle}=\bigl{|}1,1,\ldots,1\bigr{\rangle}$
or, otherwise, $\bigl{|}t\bigr{\rangle}$ remains invariant at the output.
Supplementary Figure 8 depicts the symbolic representation of
$\widehat{\mathrm{F}}_{\mathrm{C}}$, the same as that of a multi-controlled
quantum gate for simplicity. Nevertheless, in contrast to QC, note that
$\widehat{\mathrm{F}}_{\mathrm{C}}$ will be a non-unitary operation when
$\widehat{\mathrm{F}}\widehat{\mathrm{F}}^{\dagger}\neq\widehat{1}$, that is,
when $\widehat{\mathrm{F}}$ is a G- or M-gate.

Supplementary Figure 8. Functional scheme and symbolic representation of a
controlled-$\widehat{\mathrm{F}}$ gate with $n$ control anbits
$\bigl{|}c_{1,2,\ldots,n}\bigr{\rangle}\in\left\\{\bigl{|}0\bigr{\rangle},\bigl{|}1\bigr{\rangle}\right\\}$
and a single target anbit $\bigl{|}t\bigr{\rangle}$. Inspired in a multi-
controlled quantum gate, the single-anbit operation $\widehat{\mathrm{F}}$ (a
U-, G-, or M-gate) is applied to $\bigl{|}t\bigr{\rangle}$ when
$\bigl{|}c_{1},c_{2},\ldots,c_{n}\bigr{\rangle}=\bigl{|}1,1,\ldots,1\bigr{\rangle}$
or, otherwise, $\bigl{|}t\bigr{\rangle}$ remains invariant at the output.

Now, the Hilbert space is
$\mathscr{E}_{n+1}=\mathscr{E}_{1}^{\otimes\left(n\right)}$ and the canonical
(orthonormal) vector basis is found to be:

$\mathcal{B}_{n+1}=\left\\{\bigl{|}k_{1}\bigr{\rangle}\otimes\bigl{|}k_{2}\bigr{\rangle}\otimes\ldots\otimes\bigl{|}k_{n+1}\bigr{\rangle}\right\\}_{k_{1,\ldots,n+1}\in\left\\{0,1\right\\}}.$
(79)

Hence, the matrix representation of $\widehat{\mathrm{F}}_{\mathrm{C}}$
associated to $\mathcal{B}_{n+1}$ is:

$F_{\mathrm{C}}=M_{\mathcal{B}_{n+1}}^{\mathcal{B}_{n+1}}\bigl{(}\widehat{\mathrm{F}}_{\mathrm{C}}\bigr{)}=\left(\begin{array}[]{c|c}I&0\\\
\hline\cr 0&F\end{array}\right),$ (80)

where $F_{\mathrm{C}}\in M_{2^{n+1}}\left(\mathbb{C}\right)$, $I$ is the
identity matrix of size
$\bigl{(}2^{n+1}-2\bigr{)}\times\bigl{(}2^{n+1}-2\bigr{)}$ and $F\in
M_{2}\left(\mathbb{C}\right)$ is the matrix representation of
$\widehat{\mathrm{F}}$ associated to the canonical basis
$\mathcal{B}_{1}=\left\\{\left|0\right\rangle,\left|1\right\rangle\right\\}$
of $\mathscr{E}_{1}$ (see Supplementary Equation 42). Moreover, the ket-bra
representation of $\widehat{\mathrm{F}}_{\mathrm{C}}$ can be calculated from
the entries of $F_{\mathrm{C}}$ in the same way as in a controlled gate with a
single control anbit (see p. 70).

##### Properties.

A multi-controlled anbit gate has the same properties as a controlled gate
with a single control anbit, see p. Properties.. Nonetheless, now we work with
endomorphisms $\widehat{\mathrm{F}}_{\mathrm{C}}$ of the Hilbert space
$\mathscr{E}_{n+1}=\mathscr{E}_{1}^{\otimes\left(n\right)}$ and matrices
$F_{\mathrm{C}}$ belonging to $\mathrm{U}\bigl{(}2^{n+1}\bigr{)}$,
$\mathrm{GL}\bigl{(}2^{n+1},\mathbb{C}\bigr{)}$ or
$\mathfrak{gl}\bigl{(}2^{n+1},\mathbb{C}\bigr{)}$ when $F$ is a U-, G-, or
M-gate, respectively.

In addition, it should be noted that the PIP implementation of a multi-
controlled gate can be designed as in a single-controlled gate: using an
electro-optic or an all-optical architecture. In the former case, the
amplitudes of the control anbits
$\bigl{|}c_{k}\bigr{\rangle}=c_{k,0}\bigl{|}0\bigr{\rangle}+c_{k,1}\bigl{|}1\bigr{\rangle}$
($k\in\left\\{1,\ldots,n\right\\}$) are encoded by the electrical control
signals of the PIP platform and the amplitudes of the target anbit
$\bigl{|}t\bigr{\rangle}=t_{0}\bigl{|}0\bigr{\rangle}+t_{1}\bigl{|}1\bigr{\rangle}$
are encoded by a 2D optical wave (Supplementary Figure 9a). In the latter
case, the amplitudes of
$\bigl{|}c_{1},c_{2},\ldots,c_{n}\bigr{\rangle}\otimes\bigl{|}t\bigr{\rangle}$
associated to the vector basis $\mathcal{B}_{n+1}$ are encoded by optical
waves (Supplementary Figure 9b). Here, the reduced forward transfer matrix of
the system must be $F_{\mathrm{C}}$. Therefore, we require to use $2^{n+1}-2$
waveguides to implement the submatrix $I$ of $F_{\mathrm{C}}$ in combination
with the MCA of the submatrix $F$ (given by Fig. 3b if $F$ is a U-gate or Fig.
3c if $F$ is a G- or M-gate).

Supplementary Figure 9. PIP implementation of a multi-controlled gate with $n$
control anbits
$\bigl{|}c_{1}\bigr{\rangle},\ldots,\bigl{|}c_{n}\bigr{\rangle}$ and a single
target anbit $\bigl{|}t\bigr{\rangle}$, whose functionality is shown in
Supplementary Figure 8. a Electro-optic design. The PIP circuit is the MCA of
the single-anbit operation $\widehat{\mathrm{F}}$ associated to the target
anbit (here we depict the MCA of an M-gate to cover the general case). The
basic PIP devices are controlled by electrical signals (blue lines) mapped
with the amplitudes of the control anbits
$\bigl{|}c_{k}\bigr{\rangle}=c_{k,0}\bigl{|}0\bigr{\rangle}+c_{k,1}\bigl{|}1\bigr{\rangle}$
($k\in\left\\{1,\ldots,n\right\\}$), e.g., via software [23]. The optical
inputs encode the amplitudes of
$\bigl{|}t\bigr{\rangle}=t_{0}\bigl{|}0\bigr{\rangle}+t_{1}\bigl{|}1\bigr{\rangle}$
(black lines). b All-optical design. The optical inputs encode the amplitudes
of the tensor product
$\bigl{|}c_{1},c_{2},\ldots,c_{n}\bigr{\rangle}\otimes\bigl{|}t\bigr{\rangle}$,
given by the matrix
$\bigl{[}\bigl{|}c_{1},c_{2},\ldots,c_{n}\bigr{\rangle}\otimes\bigl{|}t\bigr{\rangle}\bigr{]}_{\mathcal{B}_{n+1}}$,
where $\left[\cdot\right]_{\mathcal{B}_{n+1}}$ is the component isomorphism
(see p. 1.4 Anbit amplitudes: component isomorphism). The whole structure
implements the matrix $F_{\mathrm{C}}$ given by Supplementary Equation 80.

As seen, the all-optical architecture entails a higher footprint than that of
the electro-optic design, which only requires to establish a mapping between
the control anbits and the electrical control signals of the PIP circuit (e.g.
via software [23]). In this fashion, the same MCAs as those of the U-, G-, and
M-gates (depicted in Fig. 3 of the paper) may be employed to perform multi-
controlled operations of each kind of gate via an electro-optic design.

##### A basic example.

So far, we have developed the theory of the multi-controlled gates in abstract
terms. To clarify these concepts, let us include an illustrative example: the
Toffoli (or CCNOT) gate, a multi-controlled operation with 2 control anbits
and 1 target anbit. Specifically, the matrix of this gate is found to be:

$U_{\mathrm{CCN}}:=\left(\begin{array}[]{c|c}I_{6\times 6}&0\\\ \hline\cr
0&\sigma_{x}\end{array}\right)=\left(\begin{array}[]{cccccccc}1&0&0&0&0&0&0&0\\\
0&1&0&0&0&0&0&0\\\ 0&0&1&0&0&0&0&0\\\ 0&0&0&1&0&0&0&0\\\ 0&0&0&0&1&0&0&0\\\
0&0&0&0&0&1&0&0\\\ 0&0&0&0&0&0&0&1\\\ 0&0&0&0&0&0&1&0\end{array}\right),$ (81)

where:

$\sigma_{x}:=\left(\begin{array}[]{cc}0&1\\\ 1&0\end{array}\right),$ (82)

is a Pauli matrix, a single-anbit U-gate termed as the NOT gate within the
literature of QC [22]. Therefore, the matrix $F$ of Supplementary Equation 80
is the Pauli matrix $\sigma_{x}$ in this example. Furthermore, the ket-bra
representation can be calculated from $U_{\mathrm{CCN}}$ as:

$\displaystyle\widehat{\mathrm{U}}_{\mathrm{CCN}}$
$\displaystyle=\bigl{|}0,0,0\bigr{\rangle}\bigl{\langle}0,0,0\bigr{|}+\bigl{|}0,0,1\bigr{\rangle}\bigl{\langle}0,0,1\bigr{|}+\bigl{|}0,1,0\bigr{\rangle}\bigl{\langle}0,1,0\bigr{|}+\bigl{|}0,1,1\bigr{\rangle}\bigl{\langle}0,1,1\bigr{|}$
$\displaystyle+\bigl{|}1,0,0\bigr{\rangle}\bigl{\langle}1,0,0\bigr{|}+\bigl{|}1,0,1\bigr{\rangle}\bigl{\langle}1,0,1\bigr{|}+\bigl{|}1,1,0\bigr{\rangle}\bigl{\langle}1,1,1\bigr{|}+\bigl{|}1,1,1\bigr{\rangle}\bigl{\langle}1,1,0\bigr{|}$
$\displaystyle=\bigl{|}0\bigr{\rangle}\bigl{\langle}0\bigr{|}\otimes\widehat{1}\otimes\widehat{1}+\bigl{|}1\bigr{\rangle}\bigl{\langle}1\bigr{|}\otimes\bigl{|}0\bigr{\rangle}\bigl{\langle}0\bigr{|}\otimes\widehat{1}+\bigl{|}1\bigr{\rangle}\bigl{\langle}1\bigr{|}\otimes\bigl{|}1\bigr{\rangle}\bigl{\langle}1\bigr{|}\otimes\widehat{\mathrm{\sigma}}_{x},$
(83)

with
$\widehat{\mathrm{\sigma}}_{x}=\bigl{|}0\bigr{\rangle}\bigl{\langle}1\bigr{|}+\bigl{|}1\bigr{\rangle}\bigl{\langle}0\bigr{|}$.

Supplementary Figure 10. PIP implementation of the Toffoli (or CCNOT) gate, a
multi-controlled anbit gate with 2 control anbits
$\bigl{|}c_{1}\bigr{\rangle}$, $\bigl{|}c_{2}\bigr{\rangle}$ and 1 target
anbit $\bigl{|}t\bigr{\rangle}$. a Electro-optic design. The PIP circuit is
the MCA of a U-gate since $F\equiv\sigma_{x}$ is a $2\times 2$ unitary matrix.
b All-optical design implementing the matrix $U_{\mathrm{CCN}}$ given by
Supplementary Equation 81.

The PIP implementation of the CCNOT gate can be carried out via an electro-
optic or an all-optical design, see Supplementary Figure 10. Both
architectures are the same as those of Supplementary Figure 9, but restricted
to the case of 2 control anbits and using the MCA of a U-gate to induce the
$\sigma_{x}$-matrix transformation on the amplitudes of
$\bigl{|}t\bigr{\rangle}$. It is worth mentioning that Supplementary Figure
10a is the same circuit as that of Fig. 4d of the paper, but including an
additional control anbit $\bigl{|}c_{2}\bigr{\rangle}$ in the electrical
domain. This result demonstrates the possibility of _scaling_ the controlled
gates to the case of multiple control anbits without requiring extra PIP
devices in the optical circuits, a fundamental feature of APC that cannot be
found in optical QC.

Finally, in Supplementary Note 5, we report how to use the Toffoli gate to
implement the Boolean logic of digital computation in APC, see p.
Supplementary Note 5: implementing other computing theories.

## Supplementary Note 3: sequential design

Here, we include additional information about the fundamental pieces required
to construct sequential APC architectures: the fan-in (FI) and fan-out (FO)
gates. Furthermore, the two sequential systems depicted in Fig. 5b and 5d of
the main text are discussed in more detail. Both examples will allow us to
establish the theoretical strategies to analyse and design sequential
architectures in APC.

### 3.1 Fan-in and fan-out gates

In this subsection, we first study the definition and mathematical properties
of the FI and FO gates and, subsequently, we propose a common PIP
implementation for both multi-anbit operations.

#### 3.1.1 Fan-in: anbit addition

##### Definition and formalism.

Consider the single-anbit Hilbert space $\mathscr{E}_{1}$. Let us define the
FI operation (anbit addition) as the linear mapping
$\widehat{\mathrm{G}}_{\mathrm{FI}}$ of
$\mathscr{E}_{2}:=\mathscr{E}_{1}\times\mathscr{E}_{1}$ which transforms the
input
$\bigl{(}\bigl{|}\psi\bigr{\rangle},\bigl{|}\varphi\bigr{\rangle}\bigr{)}$
into the output:

$\widehat{\mathrm{G}}_{\mathrm{FI}}\left(\bigl{|}\psi\bigr{\rangle},\bigl{|}\varphi\bigr{\rangle};n,m\right):=\bigl{(}n\bigl{(}\bigl{|}\psi\bigr{\rangle}+\bigl{|}\varphi\bigr{\rangle}\bigr{)},m\bigl{(}\bigl{|}\psi\bigr{\rangle}-\bigl{|}\varphi\bigr{\rangle}\bigr{)}\bigr{)},$
(84)

where $n,m\in\mathbb{C}-\left\\{0\right\\}$ are parameters of the operation
($n=m=1$ will be assumed as the _default values_ and, in such a case, the
parameters can be omitted on the left-hand side of the above equation).
Supplementary Figure 11 shows the functional scheme and symbolic
representation of the FI gate. In most sequential APC architectures, the
second output anbit
$m\bigl{(}\bigl{|}\psi\bigr{\rangle}-\bigl{|}\varphi\bigr{\rangle}\bigr{)}$
will be considered as a _garbage_ anbit and only the first output anbit
$n\bigl{(}\bigl{|}\psi\bigr{\rangle}+\bigl{|}\varphi\bigr{\rangle}\bigr{)}$
will be utilised to build a feedback loop. Nevertheless, the aim of defining
two output anbits is that, in this way, we will be able to describe the FI
gate with a square matrix, see below.

Supplementary Figure 11. Functional scheme and symbolic representation of the
fan-in (FI) gate. The values of the (complex) parameters $n,m$ should be
indicate, except for the case $n=m=1$, which are defined as the default
values.

Taking into account that the FI gate is an operation of two input and output
anbits, the underlying Hilbert space is $\mathscr{E}_{2}$ and the canonical
(orthonormal) basis is given by Supplementary Equation 32, reproduced here for
clarity:

$\mathcal{B}_{2}=\left\\{\left(\bigl{|}0\bigr{\rangle},\bigl{|}\mathbf{0}\bigr{\rangle}\right),\left(\bigl{|}1\bigr{\rangle},\bigl{|}\mathbf{0}\bigr{\rangle}\right),\left(\bigl{|}\mathbf{0}\bigr{\rangle},\bigl{|}0\bigr{\rangle}\right),\left(\bigl{|}\mathbf{0}\bigr{\rangle},\bigl{|}1\bigr{\rangle}\right)\right\\}.$
(85)

The matrix representation of $\widehat{\mathrm{G}}_{\mathrm{FI}}$ associated
to $\mathcal{B}_{2}$ is:

$\displaystyle G_{\mathrm{FI}}$
$\displaystyle=M_{\mathcal{B}_{2}}^{\mathcal{B}_{2}}\bigl{(}\widehat{\mathrm{G}}_{\mathrm{FI}}\bigr{)}$
$\displaystyle=\left(\begin{array}[]{cccc}\bigl{[}\widehat{\mathrm{G}}_{\mathrm{FI}}\left(\bigl{|}0\bigr{\rangle},\bigl{|}\mathbf{0}\bigr{\rangle}\right)\bigr{]}_{\mathcal{B}_{2}}&\bigl{[}\widehat{\mathrm{G}}_{\mathrm{FI}}\left(\bigl{|}1\bigr{\rangle},\bigl{|}\mathbf{0}\bigr{\rangle}\right)\bigr{]}_{\mathcal{B}_{2}}&\bigl{[}\widehat{\mathrm{G}}_{\mathrm{FI}}\left(\bigl{|}\mathbf{0}\bigr{\rangle},\bigl{|}0\bigr{\rangle}\right)\bigr{]}_{\mathcal{B}_{2}}&\bigl{[}\widehat{\mathrm{G}}_{\mathrm{FI}}\left(\bigl{|}\mathbf{0}\bigr{\rangle},\bigl{|}1\bigr{\rangle}\right)\bigr{]}_{\mathcal{B}_{2}}\end{array}\right)$
(87)
$\displaystyle=\left(\begin{array}[]{cccc}\bigl{[}\left(n\bigl{|}0\bigr{\rangle},m\bigl{|}0\bigr{\rangle}\right)\bigr{]}_{\mathcal{B}_{2}}&\bigl{[}\left(n\bigl{|}1\bigr{\rangle},m\bigl{|}1\bigr{\rangle}\right)\bigr{]}_{\mathcal{B}_{2}}&\bigl{[}\left(n\bigl{|}0\bigr{\rangle},-m\bigl{|}0\bigr{\rangle}\right)\bigr{]}_{\mathcal{B}_{2}}&\bigl{[}\left(n\bigl{|}1\bigr{\rangle},-m\bigl{|}1\bigr{\rangle}\right)\bigr{]}_{\mathcal{B}_{2}}\end{array}\right)$
(89) $\displaystyle=\left(\begin{array}[]{c|c}nI&nI\\\ \hline\cr
mI&-mI\end{array}\right).$ (92)

Thus, using the component isomorphism $\left[\cdot\right]_{\mathcal{B}_{2}}$,
Supplementary Equation 84 can be recast as:

$\left[\bigl{(}n\bigl{(}\bigl{|}\psi\bigr{\rangle}+\bigl{|}\varphi\bigr{\rangle}\bigr{)},m\bigl{(}\bigl{|}\psi\bigr{\rangle}-\bigl{|}\varphi\bigr{\rangle}\bigr{)}\bigr{)}\right]_{\mathcal{B}_{2}}=G_{\mathrm{FI}}\left[\bigl{(}\bigl{|}\psi\bigr{\rangle},\bigl{|}\varphi\bigr{\rangle}\bigr{)}\right]_{\mathcal{B}_{2}},$
(93)

leading to the following input-output matrix relation:

$\left(\begin{array}[]{c}n\left(\psi_{0}+\varphi_{0}\right)\\\
n\left(\psi_{1}+\varphi_{1}\right)\\\ m\left(\psi_{0}-\varphi_{0}\right)\\\
m\left(\psi_{1}-\varphi_{1}\right)\end{array}\right)=\left(\begin{array}[]{c|c}\begin{array}[]{cc}n&0\\\
0&n\end{array}&\begin{array}[]{cc}n&0\\\ 0&n\end{array}\\\
\hline\cr\begin{array}[]{cc}m&0\\\ 0&m\end{array}&\begin{array}[]{cc}-m&0\\\
0&-m\end{array}\end{array}\right)\left(\begin{array}[]{c}\psi_{0}\\\
\psi_{1}\\\ \varphi_{0}\\\ \varphi_{1}\end{array}\right).$ (94)

Setting $n=m=1$, the above expression describes the computational system
depicted in Fig. 5a of the paper.

As seen, defining the FI operation via the _Cartesian product_ , we are able
to: (_i_) work with (square) matrices providing a linear nature to this gate,
(_ii_) independently transform the anbit amplitudes $\psi_{0}$, $\psi_{1}$,
$\varphi_{0}$ and $\varphi_{1}$. Alternatively, we could define the FI gate
via the _tensor product_. Nonetheless, in such a scenario, it is worthy to
highlight that this version of the FI gate would have a nonlinear nature
because we could not describe this multi-anbit operation via a matrix. The
proof of this statement can be done in three steps. Firstly, note that the
definition of the FI gate via the tensor product would be of the form:

$\widehat{\mathrm{G}}_{\mathrm{FI}}\bigl{|}\psi,\varphi\bigr{\rangle}:=\bigl{|}\psi+\varphi\bigr{\rangle}\otimes\bigl{|}\psi-\varphi\bigr{\rangle}=\sum_{k,l}\bigl{(}\psi_{k}+\varphi_{k}\bigr{)}\bigl{(}\psi_{l}-\varphi_{l}\bigr{)}\bigl{|}k,l\bigr{\rangle}.$
(95)

Secondly, we should derive the “apparent” matrix representation of
$\widehat{\mathrm{G}}_{\mathrm{FI}}$ associated to the canonical basis
$\mathcal{B}_{2}$ of $\mathscr{E}_{1}\otimes\mathscr{E}_{1}$ (given by
Supplementary Equation 24):

$G_{\mathrm{FI}}=M_{\mathcal{B}_{2}}^{\mathcal{B}_{2}}\bigl{(}\widehat{\mathrm{G}}_{\mathrm{FI}}\bigr{)}=\bigl{(}\begin{array}[]{ccc}\cdots&\bigl{[}\widehat{\mathrm{G}}_{\mathrm{FI}}\bigl{|}k,l\bigr{\rangle}\bigr{]}_{\mathcal{B}_{2}}&\cdots\end{array}\bigr{)}=\left(\begin{array}[]{cccc}0&0&0&0\\\
0&-1&0&0\\\ 0&0&-1&0\\\ 0&0&0&0\end{array}\right).$ (96)

Thirdly, we should compare the output generated by
$\widehat{\mathrm{G}}_{\mathrm{FI}}$ with the output generated by
$G_{\mathrm{FI}}$. The operator $\widehat{\mathrm{G}}_{\mathrm{FI}}$ leads to
the output described by Supplementary Equation 95, whose components associated
to $\mathcal{B}_{2}$ are:

$\bigl{[}\widehat{\mathrm{G}}_{\mathrm{FI}}\bigl{|}\psi,\varphi\bigr{\rangle}\bigr{]}_{\mathcal{B}_{2}}=\left(\begin{array}[]{c}\bigl{(}\psi_{0}+\varphi_{0}\bigr{)}\bigl{(}\psi_{0}-\varphi_{0}\bigr{)}\\\
\bigl{(}\psi_{0}+\varphi_{0}\bigr{)}\bigl{(}\psi_{1}-\varphi_{1}\bigr{)}\\\
\bigl{(}\psi_{1}+\varphi_{1}\bigr{)}\bigl{(}\psi_{0}-\varphi_{0}\bigr{)}\\\
\bigl{(}\psi_{1}+\varphi_{1}\bigr{)}\bigl{(}\psi_{1}-\varphi_{1}\bigr{)}\end{array}\right).$
(97)

However, the matrix $G_{\mathrm{FI}}$ gives rise to a different output:

$G_{\mathrm{FI}}\left[\bigl{|}\psi,\varphi\bigr{\rangle}\right]_{\mathcal{B}_{2}}=\left(\begin{array}[]{cccc}0&0&0&0\\\
0&-1&0&0\\\ 0&0&-1&0\\\
0&0&0&0\end{array}\right)\left(\begin{array}[]{c}\psi_{0}\varphi_{0}\\\
\psi_{0}\varphi_{1}\\\ \psi_{1}\varphi_{0}\\\
\psi_{1}\varphi_{1}\end{array}\right)=\left(\begin{array}[]{c}0\\\
-\psi_{0}\varphi_{1}\\\ -\psi_{1}\varphi_{0}\\\ 0\end{array}\right).$ (98)

Consequently, $\widehat{\mathrm{G}}_{\mathrm{FI}}$ has no matrix
representation. This implies that the global output (Supplementary Equation
97) is different from the linear superposition of the outputs generated by
each vector of the basis $\mathcal{B}_{2}$ (Supplementary Equation 98). In
other words, $\widehat{\mathrm{G}}_{\mathrm{FI}}$ is a nonlinear mapping of
$\mathscr{E}_{1}\otimes\mathscr{E}_{1}$. For this reason, the FI gate is
defined by using the Cartesian product as indicated by Supplementary Equation
84.

##### Properties.

The FI gate illustrated in Supplementary Figure 11 exhibits the following
properties:

  1. 1.

_Automorphism_. The linear operator $\widehat{\mathrm{G}}_{\mathrm{FI}}$ is an
automorphism of the Hilbert space
$\mathscr{E}_{2}=\mathscr{E}_{1}\times\mathscr{E}_{1}$, i.e., a bijective
endomorphism given that the FI gate is reversible, as demonstrated in property
2.

  2. 2.

_Reversibility_. From Supplementary Equation 92, it follows that:

$\det\bigl{(}G_{\mathrm{FI}}\bigr{)}=4n^{2}m^{2}\neq 0,$ (99)

that is, the FI gate is reversible.

  3. 3.

_Commutativity_. The operation $\widehat{\mathrm{G}}_{\mathrm{FI}}$ holds the
commutative property:

$\widehat{\mathrm{G}}_{\mathrm{FI}}\left(\bigl{|}\psi\bigr{\rangle},\bigl{|}\varphi\bigr{\rangle};n,m\right)=\widehat{\mathrm{G}}_{\mathrm{FI}}\left(\bigl{|}\varphi\bigr{\rangle},\bigl{|}\psi\bigr{\rangle};n,-m\right).$
(100)

The order of the input anbits can be commuted preserving the state of the
output anbits, provided that the sign of the second parameter is inverted.

  4. 4.

_FI-FO connection_. The FO operation (defined below) of the anbit
$\bigl{|}\psi\bigr{\rangle}$ can be performed by the FI gate setting
$\bigl{|}\varphi\bigr{\rangle}=\bigl{|}\mathbf{0}\bigr{\rangle}$ and
$n,m\in\mathbb{R}^{+}$ in Supplementary Equation 84. Moreover, a perfect
cloning of $\bigl{|}\psi\bigr{\rangle}$ will be carried out taking $n=m=1$.

  5. 5.

_Algebraic structure_. If $\left|n\right|^{2}=\left|m\right|^{2}=1/2$, then
$G_{\mathrm{FI}}\in\mathrm{U}\left(4\right)$ and FI is a 2-anbit U-gate.
Otherwise, $G_{\mathrm{FI}}\in\mathrm{GL}\left(4,\mathbb{C}\right)$ and FI is
a 2-anbit G-gate.

  6. 6.

_Universality and PIP implementation_. A universal matrix of the FI gate is of
the form given by Supplementary Equation 92. A PIP implementation of such a
matrix preserves the universality if the values of the parameters $n$ and $m$
may be optically tuned. Along this line, note that when $n=m$ then
$G_{\mathrm{FI}}=G_{\mathrm{FI}}^{T}$ and, therefore, if the circuit preserves
the Lorentz reciprocity, we may conclude that the circuit will also preserve
the FB symmetry (as inferred from comment 6 on page 49). Remarkably, the PIP
implementation of the FI gate depicted in Fig. 5a and Supplementary Figure 13
satisfies this property.

#### 3.1.2 Fan-out: anbit cloning

##### Definition and formalism.

Consider the single-anbit Hilbert space $\mathscr{E}_{1}$. Let us define the
FO operation (anbit cloning) as the linear mapping
$\widehat{\mathrm{M}}_{\mathrm{FO}}$ of
$\mathscr{E}_{2}:=\mathscr{E}_{1}\times\mathscr{E}_{1}$ which transforms the
input
$\bigl{(}\bigl{|}\psi\bigr{\rangle},\bigl{|}\varphi\bigr{\rangle}\bigr{)}$
into the output:

$\widehat{\mathrm{M}}_{\mathrm{FO}}\left(\bigl{|}\psi\bigr{\rangle},\bigl{|}\varphi\bigr{\rangle};n,m\right):=\bigl{(}n\bigl{|}\psi\bigr{\rangle},m\bigl{|}\psi\bigr{\rangle}\bigr{)},$
(101)

where $n,m\in\mathbb{R}^{+}$ are parameters of the operation ($n=m=1$ will be
assumed as the _default values_ and, in such a case, the parameters can be
omitted on the left-hand side of the above equation). Here, note that
$\bigl{|}\varphi\bigr{\rangle}$ is an _ancilla_ anbit since we are only
interested in cloning a single input anbit ($\bigl{|}\psi\bigr{\rangle}$).
Nonetheless, the aim of defining two input anbits is that, in this vein, we
will be able to describe the FO operation via a square matrix, see below.
Supplementary Figure 12 shows the functional scheme and symbolic
representation of the FO gate.

Supplementary Figure 12. Functional scheme and symbolic representation of the
fan-out (FO) gate. The values of the (positive real) parameters $n,m$ should
be indicate, except for the case $n=m=1$, which are defined as the default
values and give rise to a perfect cloning of the input anbit
$\bigl{|}\psi\bigr{\rangle}$.

The goal of the FO gate is to introduce an operation in APC that allows us to
duplicate the state of an anbit with the same norm (perfect cloning, $n=m=1$)
or a different norm (imperfect cloning, $n\neq 1$ or $m\neq 1$), but without
introducing an additional phase. To this end, the parameters $n$ and $m$ must
be assumed positive real constants.

Bearing in mind that the FO gate is an operation of two input and output
anbits, the underlying Hilbert space is $\mathscr{E}_{2}$ and the canonical
(orthonormal) basis is $\mathcal{B}_{2}$, given by Supplementary Equation 85.
In this scenario, the matrix representation of
$\widehat{\mathrm{M}}_{\mathrm{FO}}$ associated to $\mathcal{B}_{2}$ is:

$\displaystyle M_{\mathrm{FO}}$
$\displaystyle=M_{\mathcal{B}_{2}}^{\mathcal{B}_{2}}\bigl{(}\widehat{\mathrm{M}}_{\mathrm{FO}}\bigr{)}$
$\displaystyle=\left(\begin{array}[]{cccc}\bigl{[}\widehat{\mathrm{M}}_{\mathrm{FO}}\left(\bigl{|}0\bigr{\rangle},\bigl{|}\mathbf{0}\bigr{\rangle}\right)\bigr{]}_{\mathcal{B}_{2}}&\bigl{[}\widehat{\mathrm{M}}_{\mathrm{FO}}\left(\bigl{|}1\bigr{\rangle},\bigl{|}\mathbf{0}\bigr{\rangle}\right)\bigr{]}_{\mathcal{B}_{2}}&\bigl{[}\widehat{\mathrm{M}}_{\mathrm{FO}}\left(\bigl{|}\mathbf{0}\bigr{\rangle},\bigl{|}0\bigr{\rangle}\right)\bigr{]}_{\mathcal{B}_{2}}&\bigl{[}\widehat{\mathrm{M}}_{\mathrm{FO}}\left(\bigl{|}\mathbf{0}\bigr{\rangle},\bigl{|}1\bigr{\rangle}\right)\bigr{]}_{\mathcal{B}_{2}}\end{array}\right)$
(103)
$\displaystyle=\left(\begin{array}[]{cccc}\bigl{[}\left(n\bigl{|}0\bigr{\rangle},m\bigl{|}0\bigr{\rangle}\right)\bigr{]}_{\mathcal{B}_{2}}&\bigl{[}\left(n\bigl{|}1\bigr{\rangle},m\bigl{|}1\bigr{\rangle}\right)\bigr{]}_{\mathcal{B}_{2}}&\bigl{[}\left(\bigl{|}\mathbf{0}\bigr{\rangle},\bigl{|}\mathbf{0}\bigr{\rangle}\right)\bigr{]}_{\mathcal{B}_{2}}&\bigl{[}\left(\bigl{|}\mathbf{0}\bigr{\rangle},\bigl{|}\mathbf{0}\bigr{\rangle}\right)\bigr{]}_{\mathcal{B}_{2}}\end{array}\right)$
(105) $\displaystyle=\left(\begin{array}[]{c|c}nI&0\\\ \hline\cr
mI&0\end{array}\right).$ (108)

Hence, applying the component isomorphism
$\left[\cdot\right]_{\mathcal{B}_{2}}$ to Supplementary Equation 101, the
input-output relation of the FO gate can be expressed by the matrix relation:

$\left(\begin{array}[]{c}n\psi_{0}\\\ n\psi_{1}\\\ m\psi_{0}\\\
m\psi_{1}\end{array}\right)=\left(\begin{array}[]{c|c}\begin{array}[]{cc}n&0\\\
0&n\end{array}&\begin{array}[]{cc}0&0\\\ 0&0\end{array}\\\
\hline\cr\begin{array}[]{cc}m&0\\\ 0&m\end{array}&\begin{array}[]{cc}0&0\\\
0&0\end{array}\end{array}\right)\left(\begin{array}[]{c}\psi_{0}\\\
\psi_{1}\\\ \varphi_{0}\\\ \varphi_{1}\end{array}\right).$ (109)

It should be noted that the third and fourth columns of $M_{\mathrm{FO}}$ are
found to be null as a direct consequence that the FO gate must clone
$\bigl{|}\psi\bigr{\rangle}$ at the output for any ancilla anbit
$\bigl{|}\varphi\bigr{\rangle}$ at the input. The main drawback of a matrix
with two null columns is that its optical implementation will be restricted to
a few number of PIP architectures.

In order to circumvent this technological limitation, let us take
$\bigl{|}\varphi\bigr{\rangle}=\bigl{|}\mathbf{0}\bigr{\rangle}$. As a result,
the entries of the third and fourth columns of $M_{\mathrm{FO}}$ can be
regarded as degrees of freedom ($\alpha_{kl}\in\mathbb{C}$ with
$k\in\left\\{1,\ldots,4\right\\}$ and $l\in\left\\{3,4\right\\}$):

$\left(\begin{array}[]{c}n\psi_{0}\\\ n\psi_{1}\\\ m\psi_{0}\\\
m\psi_{1}\end{array}\right)=\left(\begin{array}[]{c|c}\begin{array}[]{cc}n&0\\\
0&n\end{array}&\begin{array}[]{cc}\alpha_{13}&\alpha_{14}\\\
\alpha_{23}&\alpha_{24}\end{array}\\\ \hline\cr\begin{array}[]{cc}m&0\\\
0&m\end{array}&\begin{array}[]{cc}\alpha_{33}&\alpha_{34}\\\
\alpha_{43}&\alpha_{44}\end{array}\end{array}\right)\left(\begin{array}[]{c}\psi_{0}\\\
\psi_{1}\\\ 0\\\ 0\end{array}\right).$ (110)

Remarkably, this new version of $M_{\mathrm{FO}}$ can be implemented by a
larger gamut of PIP circuits than in Supplementary Equation 109. As a by-
product, the same optical implementation of the FI gate could also be employed
to implement $M_{\mathrm{FO}}$, leading to a common PIP architecture for both
operations (see below p. 3.1.3 PIP implementation: a common architecture).

Finally, we should discuss the importance of defining the FO gate by using the
_Cartesian product_. In the same way as in the FI operation, the Cartesian
product provides a linear nature to the FO gate. Alternatively, we could
define the FO gate via the _tensor product_. Nevertheless, in such a case, the
FO gate would have a nonlinear nature. The proof of this statement may be
performed in two steps. Firstly, note that the construction of the FO gate via
the tensor product would be a mapping of
$\mathscr{E}_{1}\otimes\mathscr{E}_{1}$ defined as
$\widehat{\mathrm{M}}_{\mathrm{FO}}\bigl{|}\psi,\varphi\bigr{\rangle}:=\bigl{|}\psi,\psi\bigr{\rangle}$.
Secondly, we can directly verify that this mapping has a nonlinear nature
using _reductio ad absurdum_ (i.e. we assume a linear behaviour to find an
inconsistent conclusion):

$\displaystyle\widehat{\mathrm{M}}_{\mathrm{FO}}\bigl{|}\psi,\varphi\bigr{\rangle}$
$\displaystyle=\widehat{\mathrm{M}}_{\mathrm{FO}}\bigl{(}\psi_{0}\bigl{|}0,\varphi\bigr{\rangle}+\psi_{1}\bigl{|}1,\varphi\bigr{\rangle}\bigr{)}$
$\displaystyle=\psi_{0}\widehat{\mathrm{M}}_{\mathrm{FO}}\bigl{|}0,\varphi\bigr{\rangle}+\psi_{1}\widehat{\mathrm{M}}_{\mathrm{FO}}\bigl{|}1,\varphi\bigr{\rangle}$
$\displaystyle=\psi_{0}\bigl{|}0,0\bigr{\rangle}+\psi_{1}\bigl{|}1,1\bigr{\rangle}\neq\bigl{|}\psi,\psi\bigr{\rangle}.$
(111)

The nonlinear behaviour of this version of the FO operation (defined via the
tensor product) has extensively been discussed in QC within the context of the
no-cloning theorem [24].

##### Properties.

As commented above, any $4\times 4$ matrix of the form:

$M_{\mathrm{FO}}=\left(\begin{array}[]{c|c}nI&M_{12}\\\ \hline\cr
mI&M_{22}\end{array}\right),$ (112)

with $M_{12}$ and $M_{22}$ being $2\times 2$ arbitrary submatrices, is able to
carry out an FO operation of the input anbit $\bigl{|}\psi\bigr{\rangle}$ when
the ancilla anbit is taken to be null
$\bigl{|}\varphi\bigr{\rangle}=\bigl{|}\mathbf{0}\bigr{\rangle}$. Since this
matrix is more general than Supplementary Equation 108, let us study its
properties:

  1. 1.

_Endomorphism_ _family and FI-FO connection_. Specifically, $M_{\mathrm{FO}}$
describes a family of endomorphisms of
$\mathscr{E}_{2}=\mathscr{E}_{1}\times\mathscr{E}_{1}$. In fact, note that the
FI gate (see Supplementary Equation 92) is also described by $M_{\mathrm{FO}}$
taking $M_{12}\equiv nI$ and $M_{22}\equiv-mI$.

  2. 2.

_Reversibility_. Given that $\det\bigl{(}M_{\mathrm{FO}}\bigr{)}$ depends on
the value of the submatrices $M_{12}$ and $M_{22}$, we conclude that the FO
gate may be reversible ($\det\bigl{(}M_{\mathrm{FO}}\bigr{)}\neq 0$) or
irreversible ($\det\bigl{(}M_{\mathrm{FO}}\bigr{)}=0$).

  3. 3.

_Non-commutativity_. In contrast to the FI operation, the order of the input
anbits cannot be commuted in the FO gate.

  4. 4.

_Algebraic structure_. From the expressions
$M_{\mathrm{FO}}^{\dagger}M_{\mathrm{FO}}=I$ and
$M_{\mathrm{FO}}M_{\mathrm{FO}}^{\dagger}=I$, we infer that
$M_{\mathrm{FO}}\in\mathrm{U}\left(4\right)$ (a 2-anbit U-gate) if and only if
the next necessary and sufficient conditions are fulfilled: (1)
$n^{2}+m^{2}=1$, (2) $nM_{12}+mM_{22}=0$, (3)
$M_{12}^{\dagger}M_{12}+M_{22}^{\dagger}M_{22}=I$, (4)
$M_{12}M_{12}^{\dagger}=\bigl{(}1-n^{2}\bigr{)}I$, (5)
$M_{22}M_{12}^{\dagger}=-nmI$, (6)
$M_{22}M_{22}^{\dagger}=\bigl{(}1-m^{2}\bigr{)}I$. For instance,
$n=m=1/\sqrt{2}$ and $M_{12}=-M_{22}=\bigl{(}1/\sqrt{2}\bigr{)}I$ satisfy the
above conditions. On the other hand,
$M_{\mathrm{FO}}\in\mathrm{GL}\left(4,\mathbb{C}\right)$ (a 2-anbit G-gate) by
taking parameters $n,m$ and submatrices $M_{12}$ and $M_{22}$ guaranteeing
that $\det\bigl{(}M_{\mathrm{FO}}\bigr{)}\neq 0$. As an example, $n=m=1$ and
$M_{12}=-M_{22}=I$ satisfy these conditions. Finally, the cases where
$\det\bigl{(}M_{\mathrm{FO}}\bigr{)}=0$ correspond to an irreversible 2-anbit
M-gate.

#### 3.1.3 PIP implementation: a common architecture

From the study of the FI and FO gates, we know that both operations are
connected via the equation:

$\widehat{\mathrm{M}}_{\mathrm{FO}}\left(\bigl{|}\psi\bigr{\rangle},\bigl{|}\varphi\bigr{\rangle};n,m\right)=\widehat{\mathrm{G}}_{\mathrm{FI}}\left(\bigl{|}\psi\bigr{\rangle},\bigl{|}\mathbf{0}\bigr{\rangle};n,m\right).$
(113)

Thus, the PIP circuit of the FI gate will also be able to perform the FO
operation by taking
$\bigl{|}\varphi\bigr{\rangle}=\bigl{|}\mathbf{0}\bigr{\rangle}$.
Supplementary Figure 13 shows the optical circuit of the FI gate, whose
(reduced) forward transfer matrix is $G_{\mathrm{FI}}$ (Supplementary Equation
92).

Supplementary Figure 13. PIP implementation of both fan-in (FI) and fan-out
(FO) gates using an optical circuit whose (reduced) forward transfer matrix is
given by $G_{\mathrm{FI}}$ (Supplementary Equation 92). The circuit carries
out the FI operation by mapping the anbit amplitudes of
$\bigl{|}\psi\bigr{\rangle}\times\bigl{|}\varphi\bigr{\rangle}$ into the anbit
amplitudes of
$n\bigl{(}\bigl{|}\psi\bigr{\rangle}+\bigl{|}\varphi\bigr{\rangle}\bigr{)}\times
m\bigl{(}\bigl{|}\psi\bigr{\rangle}-\bigl{|}\varphi\bigr{\rangle}\bigr{)}$,
with $n,m\in\mathbb{C}-\left\\{0\right\\}$. In addition, the FO operation of
$\bigl{|}\psi\bigr{\rangle}$ can be performed by setting
$\bigl{|}\varphi\bigr{\rangle}=\bigl{|}\mathbf{0}\bigr{\rangle}$ and using
positive real parameters $n,m$.

This architecture is constructed from two identical $2\times 2$ subsystems
implementing the reduced forward transfer matrix depicted within the boxes,
which may be factorised as:

$\left(\begin{array}[]{cc}n&n\\\
m&-m\end{array}\right)\equiv\underset{A}{\underbrace{\left(\begin{array}[]{cc}\sqrt{2}n&0\\\
0&-i\sqrt{2}m\end{array}\right)}}\underset{B}{\underbrace{\frac{1}{\sqrt{2}}\left(\begin{array}[]{cc}1&i\\\
i&1\end{array}\right)}}\underset{C}{\underbrace{\left(\begin{array}[]{cc}1&0\\\
0&-i\end{array}\right)}}.$ (114)

The matrices $A,B,C$ can be implemented by PSs, tunable optical
attenuators/amplifiers and a 50:50 beam splitter (the PIP implementation of
each matrix is sketched in the figure for clarity). Along this line, it should
be noted that Fig. 5a of the paper emerges from Supplementary Figure 13 by
restricting the parameters to the default values $n=m=1$.

Finally, let us conclude with a brief discussion about the reciprocity and FB
symmetry of such a structure. Assuming reciprocal and FB-symmetric
attenuators/amplifiers, the global system will preserve the Lorentz
reciprocity by exhibiting a symmetric $S$ matrix:

$S=\left(\begin{array}[]{c|c}0&G_{\mathrm{FI}}^{T}\\\ \hline\cr
G_{\mathrm{FI}}&0\end{array}\right),$ (115)

and will preserve (break) the FB symmetry when $n=m$ ($n\neq m$). This can be
easily verified by comparing the reduced forward and backward transfer
matrices of the $2\times 2$ subsystems integrating the whole structure, which
are found to be:

$\widetilde{T}_{\mathrm{f}}=\left(\begin{array}[]{cc}n&n\\\
m&-m\end{array}\right),\ \ \
\widetilde{T}_{\mathrm{b}}=\left(\begin{array}[]{cc}n&m\\\
n&-m\end{array}\right).$ (116)

As seen, $\widetilde{T}_{\mathrm{f}}=\widetilde{T}_{\mathrm{b}}$ when $n=m$.
These conclusions are in line with property 6 of the FI gate (see p. 6).

### 3.2 First sequential system of the paper

In this subsection, we will analyse in detail the _first_ sequential
architecture reported in the main text (Fig. 5b). This scheme is the simplest
sequential system that can be built in APC, composed by two FI/FO gates along
with two M-gates that complete the feedback loop. While in the paper we use
FI/FO gates with parameters fixed at the default value 1, let us consider here
FI/FO operations with arbitrary parameters to carry out a complete and
rigorous analysis of this first sequential scheme, see Supplementary Figure
14.

Supplementary Figure 14. Sequential computational system of a single anbit,
composed by 2 single-anbit M-gates ($\widehat{\mathrm{M}}_{1}$ and
$\widehat{\mathrm{M}}_{2}$), 1 FI gate and 1 FO gate. For the sake of
completeness, we use here FI/FO operations with arbitrary parameters
$n_{1},m_{1}\in\mathbb{C}-\left\\{0\right\\}$ and
$n_{2},m_{2}\in\mathbb{R}^{+}$ (however, in the paper, these parameters are
set to the default value 1 for simplicity).

##### Analysis.

The strategy to analyse any sequential architecture in APC is the same as that
of a combinational scheme: we must calculate the input-output relation, in
this example
$\bigl{|}\varphi\bigr{\rangle}=\widehat{\mathrm{M}}_{\mathrm{eq}}\bigl{|}\psi\bigr{\rangle}$.
To this end, we should find the relation of
$\widehat{\mathrm{M}}_{\mathrm{eq}}$ with the M-gates
$\widehat{\mathrm{M}}_{1}$ and $\widehat{\mathrm{M}}_{2}$ following the anbit
transformations that appear in the feedback loop. The simplest way is to start
from the output anbit:

$\bigl{|}\varphi\bigr{\rangle}=n_{2}\bigl{|}\chi\bigr{\rangle}=n_{1}n_{2}\widehat{\mathrm{M}}_{1}\bigl{|}+\bigr{\rangle}=n_{1}n_{2}\widehat{\mathrm{M}}_{1}\bigl{(}\bigl{|}\psi\bigr{\rangle}+\bigl{|}\eta\bigr{\rangle}\bigr{)}.$
(117)

Next, taking into account that
$\bigl{|}\eta\bigr{\rangle}=m_{2}\widehat{\mathrm{M}}_{2}\bigl{|}\chi\bigr{\rangle}=\bigl{(}m_{2}/n_{2}\bigr{)}\widehat{\mathrm{M}}_{2}\bigl{|}\varphi\bigr{\rangle}$,
the above equation becomes:

$\bigl{|}\varphi\bigr{\rangle}=n_{1}n_{2}\widehat{\mathrm{M}}_{1}\bigl{|}\psi\bigr{\rangle}+n_{1}m_{2}\widehat{\mathrm{M}}_{1}\widehat{\mathrm{M}}_{2}\bigl{|}\varphi\bigr{\rangle}.$
(118)

Therefore, the input-output relation of the system is found to be:

$\bigl{|}\varphi\bigr{\rangle}=n_{1}n_{2}\bigl{(}\thinspace\widehat{1}-n_{1}m_{2}\widehat{\mathrm{M}}_{1}\widehat{\mathrm{M}}_{2}\bigr{)}^{-1}\widehat{\mathrm{M}}_{1}\bigl{|}\psi\bigr{\rangle}.$
(119)

This implies that the sequential architecture is described by an _equivalent_
linear operator of the form:

$\displaystyle\widehat{\mathrm{M}}_{\mathrm{eq}}$ $\displaystyle\equiv
n_{1}n_{2}\bigl{(}\thinspace\widehat{1}-n_{1}m_{2}\widehat{\mathrm{M}}_{1}\widehat{\mathrm{M}}_{2}\bigr{)}^{-1}\widehat{\mathrm{M}}_{1},$
(120)

with $n_{1}\in\mathbb{C}-\left\\{0\right\\}$ and
$n_{2},m_{2}\in\mathbb{R}^{+}$.

Given that the system is an operation of a single anbit, the underlying
Hilbert space is $\mathscr{E}_{1}$ (with canonical basis
$\mathcal{B}_{1}=\left\\{\bigl{|}0\bigr{\rangle},\bigl{|}1\bigr{\rangle}\right\\}$).
Hence, the matrix representation of $\widehat{\mathrm{M}}_{\mathrm{eq}}$
associated to $\mathcal{B}_{1}$ is:

$M_{\mathrm{eq}}=M_{\mathcal{B}_{1}}^{\mathcal{B}_{1}}\bigl{(}\widehat{\mathrm{M}}_{\mathrm{eq}}\bigr{)}=n_{1}n_{2}\left(I-n_{1}m_{2}M_{1}M_{2}\right)^{-1}M_{1},$
(121)

where $M_{1}$ and $M_{2}$ are the matrix representations of
$\widehat{\mathrm{M}}_{1}$ and $\widehat{\mathrm{M}}_{2}$, respectively.
Setting $n_{1}=n_{2}=m_{2}\equiv 1$, Supplementary Equation 121 is reduced to
the expression of $M_{\mathrm{eq}}$ reported in the main text.

##### Properties.

The single-anbit sequential system of Supplementary Figure 14 has the next
properties:

  1. 1.

_Endomorphism_. The linear operator $\widehat{\mathrm{M}}_{\mathrm{eq}}$ is an
endomorphism of the Hilbert space $\mathscr{E}_{1}$.

  2. 2.

_Existence_. Let us rewrite Supplementary Equation 121 as
$M_{\mathrm{eq}}=n_{1}n_{2}G^{-1}M_{\mathrm{1}}$, with
$G:=I-n_{1}m_{2}M_{1}M_{2}$. As can be seen, the existence of this sequential
system (described by $M_{\mathrm{eq}}$) directly depends on the existence of
$G^{-1}$, that is:

$\exists M_{\mathrm{eq}}\Leftrightarrow\exists
G^{-1}\Leftrightarrow\det\left(G\right)\neq
0\Leftrightarrow\det\bigl{(}I-n_{1}m_{2}M_{1}M_{2}\bigr{)}\neq 0.$ (122)

Contrariwise, the sequential system could not be built because $G$ would be
singular.

  3. 3.

_Reversibility_. The gate $\widehat{\mathrm{M}}_{\mathrm{eq}}$ is reversible
(automorphism) if and only if $\det\bigl{(}G^{-1}\bigr{)}\neq 0$ and
$\det\bigl{(}M_{1}\bigr{)}\neq 0$.

  4. 4.

_Equivalent system_. Since $\widehat{\mathrm{M}}_{\mathrm{eq}}$ may be
reversible or irreversible, then the anbit transformation can be regarded as a
single-anbit combinational M-gate. In addition, it is interesting to highlight
that the system is equivalent to two different single-anbit gates
$M_{\mathrm{1}}$ and $n_{1}n_{2}G^{-1}$ connected in series (Supplementary
Figure 15). In this scenario, note that $n_{1}n_{2}G^{-1}$ actually describes
a sequential system similar to that of Supplementary Figure 14, but with the
M-gates being $I$ and $M_{\mathrm{1}}M_{\mathrm{2}}$. In particular, this
system equivalence could be employed to simplify computational architectures
that combine both combinational and sequential gates.

Supplementary Figure 15. Equivalent sequential system. The gate
$\widehat{\mathrm{M}}_{1}$ can be extracted from the upper branch of the
feedback loop following this scheme. The operator
$\widehat{\mathrm{M}}_{\mathrm{eq}}$ is the same as that of the original
system shown in Supplementary Figure 14.

  5. 5.

_Algebraic structure_. The matrix $M_{\mathrm{eq}}$ belongs to
$\mathrm{U}\left(2\right)$ (i.e. the system is equivalent to a U-gate) if
$M_{1}$ and $n_{1}n_{2}G^{-1}$ are $2\times 2$ unitary matrices. Here,
$n_{1}n_{2}G^{-1}\in\mathrm{U}\left(2\right)$ if the following necessary and
sufficient condition is satisfied:

$A^{\dagger}A-\frac{1}{n_{1}^{\ast}n_{2}}A-\frac{1}{n_{1}n_{2}}A^{\dagger}=\left(1-\frac{1}{\bigl{|}n_{1}\bigr{|}^{2}n_{2}^{2}}\right)I,$
(123)

where $A:=\bigl{(}m_{2}/n_{2}\bigr{)}M_{1}M_{2}$ and $\ast$ denotes the
complex conjugate. On the other hand, $M_{\mathrm{eq}}$ belongs to
$\mathrm{GL}\left(2,\mathbb{C}\right)$ (i.e. the system is equivalent to a
G-gate) if $M_{1}$ is a general linear matrix (here, we implicitly assume that
$G\in\mathrm{GL}\left(2,\mathbb{C}\right)$ since it is a necessary and
sufficient condition for the existence of $M_{\mathrm{eq}}$, as discussed
above). Finally, $M_{\mathrm{eq}}$ is an M-gate if $M_{1}$ is a singular
matrix (irreversible operation).

  6. 6.

_PIP implementation_. Using the circuits depicted in Figs. 3c and 5a of the
paper to implement the gates of the feedback loop illustrated in Supplementary
Figure 14, we will obtain an optical structure that breaks the Lorentz
reciprocity and the FB symmetry.

### 3.3 Second sequential system of the paper

Finally, we will analyse the _second_ sequential architecture reported in the
main text (Fig. 5d). For clarity, we reproduce this scheme in Supplementary
Figure 16 including the anbits employed in the mathematical discussions and
considering FI/FO operations with arbitrary parameters to carry out a complete
and rigorous analysis.

Supplementary Figure 16. Sequential computational system of two anbits,
composed by 2 single-anbit M-gates ($\widehat{\mathrm{M}}_{1}$ and
$\widehat{\mathrm{M}}_{2}$), 2 FI gates and 2 FO gates. For completeness, we
use FI/FO operations with arbitrary parameters
$n_{1,2},m_{1,2}\in\mathbb{C}-\left\\{0\right\\}$ and
$n_{3,4},m_{3,4}\in\mathbb{R}^{+}$.

The goal is to find the input-output relation of the structure, as well as to
demonstrate that such a mapping is equivalent to the input-output relation of
the multi-anbit combinational architecture shown in Fig. 5c of the paper. With
this approach in mind, we should start by calculating the output anbits
$\bigl{|}\varphi_{1}\bigr{\rangle}$ and $\bigl{|}\varphi_{2}\bigr{\rangle}$
independently. The output anbit $\bigl{|}\varphi_{1}\bigr{\rangle}$ can be
expressed as:

$\displaystyle\bigl{|}\varphi_{1}\bigr{\rangle}$
$\displaystyle=n_{3}\bigl{|}\chi\bigr{\rangle}$
$\displaystyle=n_{1}n_{3}\widehat{\mathrm{M}}_{1}\bigl{|}+\bigr{\rangle}$
$\displaystyle=n_{1}n_{3}\widehat{\mathrm{M}}_{1}\bigl{(}\bigl{|}\psi_{1}\bigr{\rangle}+m_{4}\bigl{|}\gamma\bigr{\rangle}\bigr{)}$
$\displaystyle=n_{1}n_{3}\widehat{\mathrm{M}}_{1}\bigl{|}\psi_{1}\bigr{\rangle}+n_{1}n_{3}m_{4}\widehat{\mathrm{M}}_{1}\bigl{|}\gamma\bigr{\rangle}$
$\displaystyle=n_{1}n_{3}\widehat{\mathrm{M}}_{1}\bigl{|}\psi_{1}\bigr{\rangle}+n_{1}n_{2}n_{3}m_{4}\widehat{\mathrm{M}}_{1}\widehat{\mathrm{M}}_{2}\bigl{|}+\bigr{\rangle}$
$\displaystyle=n_{1}n_{3}\widehat{\mathrm{M}}_{1}\bigl{|}\psi_{1}\bigr{\rangle}+n_{1}n_{2}n_{3}m_{4}\widehat{\mathrm{M}}_{1}\widehat{\mathrm{M}}_{2}\bigl{(}\bigl{|}\psi_{2}\bigr{\rangle}+m_{3}\bigl{|}\chi\bigr{\rangle}\bigr{)}$
$\displaystyle=n_{1}n_{3}\widehat{\mathrm{M}}_{1}\bigl{|}\psi_{1}\bigr{\rangle}+n_{1}n_{2}n_{3}m_{4}\widehat{\mathrm{M}}_{1}\widehat{\mathrm{M}}_{2}\bigl{(}\bigl{|}\psi_{2}\bigr{\rangle}+\frac{m_{3}}{n_{3}}\bigl{|}\varphi_{1}\bigr{\rangle}\bigr{)}$
$\displaystyle=n_{1}n_{3}\widehat{\mathrm{M}}_{1}\bigl{|}\psi_{1}\bigr{\rangle}+n_{1}n_{2}n_{3}m_{4}\widehat{\mathrm{M}}_{1}\widehat{\mathrm{M}}_{2}\bigl{|}\psi_{2}\bigr{\rangle}+n_{1}n_{2}m_{3}m_{4}\widehat{\mathrm{M}}_{1}\widehat{\mathrm{M}}_{2}\bigl{|}\varphi_{1}\bigr{\rangle}.$
(124)

Hence, $\bigl{|}\varphi_{1}\bigr{\rangle}$ is found to be:

$\displaystyle\bigl{|}\varphi_{1}\bigr{\rangle}$
$\displaystyle=n_{1}n_{3}\bigl{(}\thinspace\widehat{1}-n_{1}n_{2}m_{3}m_{4}\widehat{\mathrm{M}}_{1}\widehat{\mathrm{M}}_{2}\bigr{)}^{-1}\widehat{\mathrm{M}}_{1}\bigl{|}\psi_{1}\bigr{\rangle}$
$\displaystyle+n_{1}n_{2}n_{3}m_{4}\bigl{(}\thinspace\widehat{1}-n_{1}n_{2}m_{3}m_{4}\widehat{\mathrm{M}}_{1}\widehat{\mathrm{M}}_{2}\bigr{)}^{-1}\widehat{\mathrm{M}}_{1}\widehat{\mathrm{M}}_{2}\bigl{|}\psi_{2}\bigr{\rangle}.$
(125)

Repeating the same procedure to calculate $\bigl{|}\varphi_{2}\bigr{\rangle}$,
we obtain:

$\displaystyle\bigl{|}\varphi_{2}\bigr{\rangle}$
$\displaystyle=n_{1}n_{2}m_{3}n_{4}\bigl{(}\thinspace\widehat{1}-n_{1}n_{2}m_{3}m_{4}\widehat{\mathrm{M}}_{2}\widehat{\mathrm{M}}_{1}\bigr{)}^{-1}\widehat{\mathrm{M}}_{2}\widehat{\mathrm{M}}_{1}\bigl{|}\psi_{1}\bigr{\rangle}$
$\displaystyle+n_{2}n_{4}\bigl{(}\thinspace\widehat{1}-n_{1}n_{2}m_{3}m_{4}\widehat{\mathrm{M}}_{2}\widehat{\mathrm{M}}_{1}\bigr{)}^{-1}\widehat{\mathrm{M}}_{2}\bigl{|}\psi_{2}\bigr{\rangle}.$
(126)

For simplicity, let us compact the above expressions as:

$\displaystyle\bigl{|}\varphi_{1}\bigr{\rangle}$
$\displaystyle=\widehat{\mathrm{A}}_{1}\bigl{|}\psi_{1}\bigr{\rangle}+\widehat{\mathrm{A}}_{2}\bigl{|}\psi_{2}\bigr{\rangle},$
(127) $\displaystyle\bigl{|}\varphi_{2}\bigr{\rangle}$
$\displaystyle=\widehat{\mathrm{B}}_{1}\bigl{|}\psi_{1}\bigr{\rangle}+\widehat{\mathrm{B}}_{2}\bigl{|}\psi_{2}\bigr{\rangle},$
(128)

where the operators $\widehat{\mathrm{A}}_{1,2}$ and
$\widehat{\mathrm{B}}_{1,2}$ can be identified by comparing the corresponding
equations. Using the _Cartesian_ _product_ , the input-output relation of the
whole sequential structure is:

$\displaystyle\bigl{(}\bigl{|}\varphi_{1}\bigr{\rangle},\bigl{|}\varphi_{2}\bigr{\rangle}\bigr{)}$
$\displaystyle=\bigl{(}\widehat{\mathrm{A}}_{1}\bigl{|}\psi_{1}\bigr{\rangle}+\widehat{\mathrm{A}}_{2}\bigl{|}\psi_{2}\bigr{\rangle},\widehat{\mathrm{B}}_{1}\bigl{|}\psi_{1}\bigr{\rangle}+\widehat{\mathrm{B}}_{2}\bigl{|}\psi_{2}\bigr{\rangle}\bigr{)}$
$\displaystyle=\bigl{(}\widehat{\mathrm{A}}_{1}\bigl{|}\psi_{1}\bigr{\rangle},\widehat{\mathrm{B}}_{1}\bigl{|}\psi_{1}\bigr{\rangle}\bigr{)}+\bigl{(}\widehat{\mathrm{A}}_{2}\bigl{|}\psi_{2}\bigr{\rangle},\widehat{\mathrm{B}}_{2}\bigl{|}\psi_{2}\bigr{\rangle}\bigr{)}$
$\displaystyle=\bigl{(}\widehat{\mathrm{A}}_{1}\times\widehat{\mathrm{B}}_{1}\bigr{)}\thinspace\bigl{(}\bigl{|}\psi_{1}\bigr{\rangle},\bigl{|}\psi_{1}\bigr{\rangle}\bigr{)}+\bigl{(}\widehat{\mathrm{A}}_{2}\times\widehat{\mathrm{B}}_{2}\bigr{)}\thinspace\bigl{(}\bigl{|}\psi_{2}\bigr{\rangle},\bigl{|}\psi_{2}\bigr{\rangle}\bigr{)}.$
(129)

Furthermore, the input-output relation of the multi-anbit combinational
architecture of Fig. 5c of the paper is:

$\displaystyle\bigl{(}\bigl{|}\varphi_{1}\bigr{\rangle},\bigl{|}\varphi_{2}\bigr{\rangle}\bigr{)}$
$\displaystyle=\bigl{(}\widehat{\mathrm{M}}_{3}\bigl{|}\psi_{1}\bigr{\rangle}+\widehat{\mathrm{M}}_{5}\bigl{|}\psi_{2}\bigr{\rangle},\widehat{\mathrm{M}}_{4}\bigl{|}\psi_{1}\bigr{\rangle}+\widehat{\mathrm{M}}_{6}\bigl{|}\psi_{2}\bigr{\rangle}\bigr{)}$
$\displaystyle=\bigl{(}\widehat{\mathrm{M}}_{3}\bigl{|}\psi_{1}\bigr{\rangle},\widehat{\mathrm{M}}_{4}\bigl{|}\psi_{1}\bigr{\rangle}\bigr{)}+\bigl{(}\widehat{\mathrm{M}}_{5}\bigl{|}\psi_{2}\bigr{\rangle},\widehat{\mathrm{M}}_{6}\bigl{|}\psi_{2}\bigr{\rangle}\bigr{)}$
$\displaystyle=\bigl{(}\widehat{\mathrm{M}}_{3}\times\widehat{\mathrm{M}}_{4}\bigr{)}\thinspace\bigl{(}\bigl{|}\psi_{1}\bigr{\rangle},\bigl{|}\psi_{1}\bigr{\rangle}\bigr{)}+\bigl{(}\widehat{\mathrm{M}}_{5}\times\widehat{\mathrm{M}}_{6}\bigr{)}\thinspace\bigl{(}\bigl{|}\psi_{2}\bigr{\rangle},\bigl{|}\psi_{2}\bigr{\rangle}\bigr{)}.$
(130)

As seen, Supplementary Equations 129 and 130 are equivalent mathematical
expressions.

## Supplementary Note 4: different versions of APC

The anbit is conceived as a vector function belonging to a two-dimensional
(2D) Hilbert space. However, as commented in the main text, we have the
possibility of defining the unit of information of APC in a Hilbert space with
dimension $d\neq 2$, leading to different versions of APC, termed as $d$-APC.
In this section, we discuss how to construct the computation theory (unit of
information and basic gates) for the cases $d=1$ and $d>2$.

### 4.1 One-dimensional APC (1-APC)

#### 4.1.1 Unit of information: the analog dit

Now, the unit of information is a 1D vector function
$\bigl{|}\psi\left(t\right)\bigr{\rangle}=\psi_{0}\left(t\right)\bigl{|}0\bigr{\rangle}$
referred to as the _analog dit_ (or _andit_ for short), where $\psi_{0}$ is a
scalar complex function termed as the andit amplitude and
$\bigl{|}0\bigr{\rangle}$ is a constant unit vector. The user information is
encoded in the module and phase of $\psi_{0}$.

In the same vein as an anbit, a 1D andit may be implementable in PIP via
different modulation formats (see p. Supplementary Note 1: the analog bit).
For instance, using a SEM approach, $\psi_{0}$ can be encoded by an optical
wave packet propagated by the fundamental mode $\bigl{|}0\bigr{\rangle}$ of a
single-mode waveguide (Supplementary Figure 17). For coherence with the paper,
the temporal shape of $\psi_{0}$ is assumed rectangular, although alternative
physical implementations of a 1D andit can be proposed by exploring diverse
temporal shapes of $\psi_{0}$. In addition, the following features of a 1D
andit should be highlighted:

  * •

_Hilbert space_. The single-andit vector space
$\mathscr{E}_{1}=\mathrm{span}\left\\{\bigl{|}0\bigr{\rangle}\right\\}$ along
with the standard complex inner product
$\bigl{\langle}\cdot|\cdot\bigr{\rangle}$ lead to a 1D Hilbert space with
canonical (normal) basis
$\mathcal{B}_{1}=\left\\{\bigl{|}0\bigr{\rangle}\right\\}$ and a finite norm
$\left\|\cdot\right\|$. Specifically, $\left\|\psi\right\|^{2}$ describes the
optical power ($\mathcal{P}$) propagated by the waveguide of Supplementary
Figure 17:
$\mathcal{P}=\left\|\psi\right\|^{2}=\bigl{\langle}\psi|\psi\bigr{\rangle}=\left|\psi_{0}\right|^{2}$.

  * •

_Andit period_. The andit period $T_{\mathrm{ANDIT}}$ is the time interval
where $\psi_{0}\left(t\right)$ is defined.

  * •

_Measurement and EDFs_. The number of EDFs that can be used to encode the user
information depends solely on the kind of andit measurement employed at the
receiver. A coherent measurement retrieves the module and phase of $\psi_{0}$
(2 EDFs), while a differential measurement only recovers
$\left|\psi_{0}\right|^{2}$ (1 EDF).

  * •

_Geometric representation_. A 1D andit can be geometrically represented by
using a polar diagram illustrating the module and phase of $\psi_{0}$ in the
complex plane (Supplementary Figure 17).

  * •

_Multiple andits_. A computational system with $n$ andits will require to
operate in a Hilbert space $\mathscr{E}_{n}$ that can be constructed from
$\mathscr{E}_{1}$ using the tensor or the Cartesian product. In the former
case, we will obtain the Hilbert space
$\mathscr{E}_{n}=\mathscr{E}_{1}^{\otimes\left(n-1\right)}$, with
$\dim\bigl{(}\mathscr{E}_{n}\bigr{)}=\dim\bigl{(}\mathscr{E}_{1}\bigr{)}^{n}=1$
and canonical basis
$\mathcal{B}_{n}=\left\\{\left|0,0,\ldots,0\right\rangle\right\\}$. In the
latter case, we will obtain the Hilbert space
$\mathscr{E}_{n}=\mathscr{E}_{1}^{\times\left(n-1\right)}$, with
$\dim\bigl{(}\mathscr{E}_{n}\bigr{)}=n\dim\bigl{(}\mathscr{E}_{1}\bigr{)}=n$
and canonical basis
$\mathcal{B}_{n}=\bigl{\\{}\bigl{(}\left|0\right\rangle,\left|\mathbf{0}\right\rangle,\ldots,\left|\mathbf{0}\right\rangle\bigr{)},\bigl{(}\left|\mathbf{0}\right\rangle,\left|0\right\rangle,\ldots,\left|\mathbf{0}\right\rangle\bigr{)},\ldots,\bigl{(}\left|\mathbf{0}\right\rangle,\left|\mathbf{0}\right\rangle,\ldots,\left|0\right\rangle\bigr{)}\bigr{\\}}$.
As we will see below, in 1-APC, it is more useful to work with the Cartesian
product to define multi-andit operations.

Supplementary Figure 17. Physical implementation of a one-dimensional andit
$\bigl{|}\psi\left(t\right)\bigr{\rangle}=\psi_{0}\left(t\right)\bigl{|}0\bigr{\rangle}$
using PIP technology and a space-encoding modulation (SEM). The andit
amplitude $\psi_{0}=\left|\psi_{0}\right|e^{i\angle_{0}}$ is encoded by an
optical wave packet (or complex envelope) propagated by the fundamental mode
$\bigl{|}0\bigr{\rangle}$ of a single-mode waveguide. The andit is
geometrically represented by using a polar diagram illustrating the module
$\left|\psi_{0}\right|$ and phase $\angle_{0}$ in the complex plane.

#### 4.1.2 Single-andit linear gates

##### Definition.

In the same way as in 2-APC, a single-andit linear gate will be defined as a
linear mapping $\widehat{\mathrm{F}}$ (or endomorphism) of $\mathscr{E}_{1}$.
The operator $\widehat{\mathrm{F}}$ describes a transformation between an
input andit $\bigl{|}\psi\bigr{\rangle}=\psi_{0}\bigl{|}0\bigr{\rangle}$ and
an output andit
$\bigl{|}\varphi\bigr{\rangle}=\varphi_{0}\bigl{|}0\bigr{\rangle}$.

##### General properties.

The properties of a single-andit linear gate in 1-APC are the same as those of
a single-anbit linear gate in 2-APC, but the following details should be
highlighted:

  * •

_Scalar representation_. Instead of using a matrix representation, the input-
output relation
$\bigl{|}\varphi\bigr{\rangle}=\widehat{\mathrm{F}}\bigl{|}\psi\bigr{\rangle}$
can equivalently be expressed via a scalar expression of the form
$\varphi_{0}=F\psi_{0}$, where $F=\left\langle
0\right|\widehat{\mathrm{F}}\left|0\right\rangle$. Utilising the component
isomorphism $\left[\cdot\right]_{\mathcal{B}_{1}}$, it is direct to
demonstrate the above equivalence:

$\varphi_{0}=\bigl{[}\bigl{|}\varphi\bigr{\rangle}\bigr{]}_{\mathcal{B}_{1}}=\bigl{[}\widehat{\mathrm{F}}\bigl{|}\psi\bigr{\rangle}\bigr{]}_{\mathcal{B}_{1}}=\psi_{0}\bigl{[}\widehat{\mathrm{F}}\bigl{|}0\bigr{\rangle}\bigr{]}_{\mathcal{B}_{1}}=\psi_{0}\left\langle
0\right|\widehat{\mathrm{F}}\left|0\right\rangle\equiv F\psi_{0}.$ (131)

  * •

_Reversibility_. By definition, the gate is reversible if and only if
$\left|F\right|\neq 0$. The inverse gate is described by the inverse operator
$\widehat{\mathrm{F}}^{-1}$, whose scalar representation is $F^{-1}=1/F$.

  * •

_Geometric representation_. A single-andit linear gate may be geometrically
interpreted as a trajectory between two different points in the complex plane,
from $\psi_{0}$ to $\varphi_{0}$.

  * •

_Classes of linear gates_. We use the same classification as in 2-APC by
considering U-, G-, and M-gates.

##### U-gates.

Since a U-gate must preserve the norm of the input andit at the output andit
($\left|\varphi_{0}\right|=\left|\psi_{0}\right|$), this class of gates is
associated to a unitary operator
$\widehat{\mathrm{F}}=e^{i\delta}\bigl{|}0\bigr{\rangle}\bigl{\langle}0\bigr{|}$
or scalar phase function $F=e^{i\delta}$. Hence, a U-gate only induces a
global phase shifting and, consequently, the MCA is a PS.

##### G- and M-gates.

The most general scalar complex function that can be defined is of the form
$F=\left|F\right|e^{i\delta}$, with arbitrary module $\left|F\right|$ and
arbitrary phase $\delta$. Such a linear mapping will describe a G-gate when
$\left|F\right|\neq 0$ (reversible operation) and will describe an M-gate when
$\left|F\right|=0$ (irreversible operation). The MCA is a PS connected in
series with a tunable optical amplifier/attenuator accounting for the
transformations $e^{i\delta}$ and $\left|F\right|$, respectively.

#### 4.1.3 Dual-andit linear gates

Using the Cartesian product, we may define a Hilbert space
$\mathscr{E}_{2}=\mathscr{E}_{1}\times\mathscr{E}_{1}$ with canonical basis
$\mathcal{B}_{2}=\bigl{\\{}\bigl{(}\left|0\right\rangle,\left|\mathbf{0}\right\rangle\bigr{)},\bigl{(}\left|\mathbf{0}\right\rangle,\left|0\right\rangle\bigr{)}\bigr{\\}}$
which is isomorphic to the Hilbert space of a single anbit in 2-APC
($\mathscr{E}_{1}^{(\textrm{2-APC})}=\mathrm{span}\left\\{\left|0\right\rangle,\left|1\right\rangle\right\\}$).
The isomorphism between both spaces is established by performing the
identifications
$\bigl{(}\left|0\right\rangle,\left|\mathbf{0}\right\rangle\bigr{)}\equiv\left|0\right\rangle$
and
$\bigl{(}\left|\mathbf{0}\right\rangle,\left|0\right\rangle\bigr{)}\equiv\left|1\right\rangle$.
In this way, any vector belonging to $\mathscr{E}_{2}$ in 1-APC of the form:

$\bigl{(}\left|\alpha\right\rangle,\left|\beta\right\rangle\bigr{)}=\bigl{(}\alpha_{0}\left|0\right\rangle,\beta_{0}\left|0\right\rangle\bigr{)}=\alpha_{0}\bigl{(}\left|0\right\rangle,\left|\mathbf{0}\right\rangle\bigr{)}+\beta_{0}\bigl{(}\left|\mathbf{0}\right\rangle,\left|0\right\rangle\bigr{)},$
(132)

has associated an anbit belonging to $\mathscr{E}_{1}^{(\textrm{2-APC})}$ of
the form
$\left|\psi\right\rangle=\alpha_{0}\left|0\right\rangle+\beta_{0}\left|1\right\rangle$.
Using this isomorphism, we can directly extrapolate the theory and circuits of
the single-anbit linear gates in 2-APC (see Fig. 3) to design and implement
dual-andit linear gates in 1-APC. As seen, the Cartesian product paves the way
to extrapolate the theory from 2-APC to 1-APC, a feature that cannot be found
by using the tensor product.

On the other hand, the study of multi-andit linear gates in 1-APC will be
investigated simultaneously along with the development of multi-anbit linear
gates in 2-APC in future works. Here, the optical structures proposed by Reck
and Clements in refs. [25, 26] could be of paramount importance to implement
multi-andit U-gates in 1-APC.

#### 4.1.4 Controlled gates

In 1-APC, a controlled gate should be defined in a different way from a
controlled gate in 2-APC given that a control andit cannot commute between two
different states. In this case, we may establish that a single-andit operation
$\widehat{\mathrm{F}}$ is applied to a target andit
$\left|t\right\rangle=t_{0}\left|0\right\rangle$ when the amplitude of the
control andit $\left|c\right\rangle=c_{0}\left|0\right\rangle$ takes a
specific complex value. In such a scenario, we can also propose an electro-
optic design to implement a controlled gate, where the target and control
andits are respectively encoded by 1D optical and electrical signals.

#### 4.1.5 Sequential design

The fundamentals of sequential architectures in 1-APC can be directly
extrapolated from 2-APC by restricting the analysis to 1D vectors. The FI and
FO gates (the basic pieces to construct sequential schemes) can be implemented
using similar circuits to those of proposed in Fig. 5a and Supplementary
Figure 13. Concretely, in Fig. 5a, we should only work with the inputs
$\psi_{0}$ and $\varphi_{0}$ and the outputs $\psi_{0}+\varphi_{0}$ and
$\psi_{0}-\varphi_{0}$ to carry out FI/FO operations of 1D andits.
Furthermore, note that the analysis and design of the sequential architectures
shown in Figs. 5b and 5d are the same in 1-APC and 2-APC.

#### 4.1.6 Nonlinear andit gates

The most general definition of a single-andit gate (including both linear and
nonlinear contributions) is given by the expression
$\widehat{\mathrm{F}}\bigl{|}\psi\bigr{\rangle}:=f_{0}\bigl{(}\psi_{0}\bigr{)}\bigl{|}0\bigr{\rangle}$,
with $f_{0}\in\mathcal{F}\left(\mathbb{C},\mathbb{C}\right)$. Thus,
$\widehat{\mathrm{F}}$ will induce a nonlinear transformation on the input
andit $\bigl{|}\psi\bigr{\rangle}$ when the scalar function $f_{0}$ has a
nonlinear behaviour. The theory of nonlinear gates in 1-APC is similar to that
of nonlinear gates in 2-APC. Here, we should only restrict the mathematical
formalism of equations 5 and 6 of the paper to 1D.

This kind of gates can be implemented in PIP, e.g., by exploiting the Pockels
and Kerr effects in a _single-mode_ waveguide to carry out second- and third-
order nonlinear andit operations, respectively. As an example, stimulating the
self-phase modulation effect in a single-mode waveguide (similar to that of
depicted in Supplementary Figure 17), a nonlinear andit transformation of the
form
$\widehat{\mathrm{F}}\bigl{|}\psi\bigr{\rangle}=\psi_{0}\exp\bigl{(}-i\gamma\bigl{|}\psi_{0}\bigr{|}^{2}L_{\mathrm{eff}}\bigr{)}\bigl{|}0\bigr{\rangle}$
may be obtained ($\gamma$ and $L_{\mathrm{eff}}$ are nonlinear parameters of
the waveguide [27]).

### 4.2 Multi-dimensional APC (_d_ -APC)

In $d$-APC with $d>2$, the unit of information is a $d$-dimensional vector
function:

$\bigl{|}\psi\left(t\right)\bigr{\rangle}=\sum_{n=0}^{d-1}\psi_{n}\left(t\right)\bigl{|}n\bigr{\rangle},$
(133)

also termed as andit, where $\psi_{0},\psi_{1},\ldots,\psi_{d-1}$ are scalar
complex functions termed as the andit amplitudes and
$\bigl{|}0\bigr{\rangle},\bigl{|}1\bigr{\rangle},\ldots,\bigl{|}d-1\bigr{\rangle}$
are constant orthonormal vectors. The user information is encoded in the
moduli and phases of the andit amplitudes.

Supplementary Figure 18. Physical implementation of a $d$-dimensional andit
using PIP technology and a space-encoding modulation (SEM). The andit
amplitudes $\psi_{0},\psi_{1},\psi_{2},\psi_{3},\ldots,\psi_{d-1}$ are encoded
by $d$ different optical wave packets (or complex envelopes) propagated by the
fundamental modes
$\bigl{|}0\bigr{\rangle},\bigl{|}1\bigr{\rangle},\bigl{|}2\bigr{\rangle},\bigl{|}3\bigr{\rangle},\ldots,\bigl{|}d-1\bigr{\rangle}$
of $d$ different single-mode waveguides.

A $d$-dimensional andit can be implemented in PIP via different modulation
formats that make use of the space, mode, frequency and time domain of light.
These modulation formats are similar to those proposed for the anbit in
Supplementary Note 1 (p. Supplementary Note 1: the analog bit), but
generalised for a $d$-dimensional vector. As an example, in a SEM technique,
we can associate
$\bigl{|}0\bigr{\rangle},\bigl{|}1\bigr{\rangle},\ldots,\bigl{|}d-1\bigr{\rangle}$
to the fundamental modes of $d$ different single-mode waveguides and the andit
amplitudes can be encoded by $d$ different optical wave packets propagated by
these fundamental modes, see Supplementary Figure 18. Moreover, although the
temporal shape of the andit amplitudes is assumed rectangular (for coherence
with the main text), diverse options may be explored in forthcoming works by
employing optical wave packets with different shapes.

The properties of a $d$-dimensional andit are similar to those of an anbit. In
particular, now, we will have $2d$ or $2d-1$ EDFs when using coherent or
differential measurement, respectively. In the latter case, the global phase
of the andit amplitudes cannot be recovered.

Once we have defined the unit of information of $d$-APC, the subsequent steps
to construct this version of the computation theory are to study single-andit
linear gates, controlled gates, FI/FO gates, sequential architectures and
nonlinear andit gates. Despite the fact that the theoretical details of these
points are out of the scope of this work, the following considerations are in
order:

  * •

From a theoretical perspective, the fundamentals of combinational and
sequential computing systems in $d$-APC are the same as those of $2$-APC. The
main difference appears in the mathematical formalism of nonlinear gates, that
will require the use of multi-dimensional multi-variable Taylor series in
$d$-APC.

  * •

From a technological perspective, the PIP implementation of single-andit gates
would require basic devices with $d$ inputs and $d$ outputs. Since the
mainstream PIP devices are $1\times 1$ and $2\times 2$ optical systems [4], a
possible difficulty might arise to implement these gates. Nonetheless, a
suitable PIP implementation of $d$-APC could be proposed using the approaches
reported in refs. [25, 26, 28], based on reconfigurable PSs, beam splitters
(combiners) and micro-ring resonators that allow to integrate the desired
number of inputs and outputs within the same optical system. As an example,
the results of ref. [28] can be directly applied to implement single-andit
U-gates in $3$-APC.

  * •

In QC, the optical implementation of universal quantum gates may be simplified
by combining the use of qubits and qudits [29]. In the same vein, $d$-APC
might be envisioned as a theoretical tool that could allow us to simplify the
PIP implementation of the analog logic of $2$-APC by utilising anbits and
andits within the same circuit.

## Supplementary Note 5: implementing other computing theories

In this section, we will discuss how to describe the unit of information and
basic operations of digital computation (DC), neuromorphic computation (NC)
and quantum computation (QC) using the mathematical framework of APC.

### 5.1 Digital computation

The implementation of DC with APC architectures requires to describe the
digital bit and the Boolean logic using the anbit and its basic gates.
Remarkably, an anbit
$\bigl{|}\psi\bigr{\rangle}=\psi_{0}\bigl{|}0\bigr{\rangle}+\psi_{1}\bigl{|}1\bigr{\rangle}$
is able to describe the digital bit by taking
$\psi_{0}\in\left\\{0,1\right\\}$ and $\psi_{1}=1-\psi_{0}$. Here, the state
of the anbit is $\bigl{|}0\bigr{\rangle}$ or $\bigl{|}1\bigr{\rangle}$, but
the possibility of having a linear combination of both states is discarded.

Furthermore, the description of the Boolean logic can be carried out in APC
keeping in mind that any Boolean function can be decomposed in terms of NAND
gates [30]. Thus, implementing the NAND operation of DC utilising basic anbit
gates, we will be able to perform any Boolean function in APC.

Supplementary Figure 19. Implementation of Boolean logic in APC. a Functional
scheme of the Toffoli (or CCNOT) gate, described by Supplementary Equation
134, a multi-anbit controlled gate with 2 control anbits
$\bigl{|}c_{1}\bigr{\rangle}$, $\bigl{|}c_{2}\bigr{\rangle}$ and 1 target
anbit $\bigl{|}t\bigr{\rangle}$. b NAND operation of DC (defined via its truth
table) implemented by the Toffoli gate in APC.

In this scenario, note that the linear unitary mapping of the Toffoli (or
CCNOT) gate given by Supplementary Equation 83 can be recast of the form [22,
31]:

$\displaystyle\bigl{|}c_{1},c_{2},t\bigr{\rangle}\overset{{}_{\textrm{CCNOT}}}{\longrightarrow}$
$\displaystyle\widehat{\mathrm{U}}_{\mathrm{CCN}}\bigl{|}c_{1},c_{2},t\bigr{\rangle}=\bigl{|}c_{1},c_{2},t\oplus
c_{1}\wedge c_{2}\bigr{\rangle},$ (134)

where $\oplus$ is the modulo-2 addition and $\wedge$ is the AND operation
(Supplementary Figure 19a). This expression allows us to infer that the
Toffoli gate may be employed to implement the NAND gate:

$\mathrm{NAND}\bigl{(}b_{1},b_{2}\bigr{)}:=\lnot\bigl{(}b_{1}\wedge
b_{2}\bigr{)}=1\oplus b_{1}\wedge b_{2},$ (135)

by performing the following identification:

$\bigl{|}b_{1},b_{2},\mathrm{NAND}\bigl{(}b_{1},b_{2}\bigr{)}\bigr{\rangle}=\bigl{|}b_{1},b_{2},1\oplus
b_{1}\wedge
b_{2}\bigr{\rangle}\equiv\widehat{\mathrm{U}}_{\mathrm{CCN}}\bigl{|}b_{1},b_{2},1\bigr{\rangle},$
(136)

where $b_{1}$ and $b_{2}$ are digital bits (i.e.,
$b_{1,2}\in\left\\{0,1\right\\}$) playing the role of the control anbits in
the Toffoli gate. Moreover, the target anbit is set to
$\bigl{|}t\bigr{\rangle}=\bigl{|}1\bigr{\rangle}$ at the input (Supplementary
Figure 19b). As seen, the use of the Toffoli gate in APC to implement the NAND
gate of DC requires 1 ancilla anbit and 2 garbage anbits (the same remark is
found in QC to implement DC via the quantum Toffoli gate [22, 31]). Likewise,
let us remember that the PIP implementation of the Toffoli gate is shown in
Supplementary Figure 10 (see p. A basic example.).

On the other hand, a complete implementation of DC in APC requires the ability
to build sequential digital circuits (e.g., digital memories). To this end,
latches and flip-flops (the basic building blocks of most sequential digital
systems [30]) could be mimicked in APC by employing sequential anbit
computational schemes. This point should be further investigated in
forthcoming works.

### 5.2 Neuromorphic computation

NC is a computational model inspired by signal processing in the brain using
the so-called artificial neural networks (ANNs) [32, 33]. The functional
principle of an ANN is sketched in Supplementary Figure 20. Specifically, an
ANN is arranged in several layers, which are composed by small processing
units known as _neurons_. Each neuron processes a 1D complex signal (the unit
of information in NC). In this example, we observe 3 layers with 3 neurons per
layer. Mathematically, the communication between two adjacent layers can be
modelled in two steps [33]:

  1. 1.

Firstly, it is performed a matrix transformation of a 3D input vector
$\mathbf{x}=\left(x_{1},x_{2},x_{3}\right)$, composed by 3 different units of
information $x_{1,2,3}$. The output is also a 3D vector
$\mathbf{y}=\left(y_{1},y_{2},y_{3}\right)$ (the dimension of $\mathbf{x}$ and
$\mathbf{y}$ depends on the number of neurons per layer). Hence, this first
step is a multi-linear mapping described by a matrix equation of the form
$\mathbf{y}=M\mathbf{x}$, where $M$ is a $3\times 3$ matrix with complex
entries.

  2. 2.

Secondly, a nonlinear function
$f\in\mathcal{F}\left(\mathbb{C},\mathbb{C}\right)$ is applied on each
component $y_{k}$ of the vector $\mathbf{y}$. The output of this second step
is a 3D vector $\mathbf{z}=\left(z_{1},z_{2},z_{3}\right)$ with
$z_{k}=f\left(y_{k}\right)$, $\forall k\in\left\\{1,2,3\right\\}$.

Supplementary Figure 20. Artificial neural network (ANN) with 3 neurons per
layer [33].

Therefore, the description of NC is straightforward by using 1-APC (see
Supplementary Note 4, on p. Supplementary Note 4: different versions of APC).
In order to explain the connection between NC and 1-APC as simple as possible,
let us describe the ANN depicted in Supplementary Figure 20 via 1-APC. In such
a scenario, the following considerations are in order:

  * •

Firstly, we should note that the unit of information of NC may be described by
a 1D andit. For instance, the unit of information $x_{1}$ can be described by
a 1D andit of the form
$\bigl{|}x_{1}\bigr{\rangle}=x_{1}\bigl{|}0\bigr{\rangle}$.

  * •

Secondly, the 3D input vector $\mathbf{x}=\left(x_{1},x_{2},x_{3}\right)$
should be written as a function of 3 different 1D andits
$\bigl{|}x_{1}\bigr{\rangle}=x_{1}\bigl{|}0\bigr{\rangle}$,
$\bigl{|}x_{2}\bigr{\rangle}=x_{2}\bigl{|}0\bigr{\rangle}$ and
$\bigl{|}x_{3}\bigr{\rangle}=x_{3}\bigl{|}0\bigr{\rangle}$ connected via the
Cartesian product. Hence, the vector $\mathbf{x}$ may be described by a ket of
the form
$\bigl{|}X\bigr{\rangle}=\bigl{|}x_{1}\bigr{\rangle}\times\bigl{|}x_{2}\bigr{\rangle}\times\bigl{|}x_{3}\bigr{\rangle}$.
In the same vein, the vectors $\mathbf{y}=\left(y_{1},y_{2},y_{3}\right)$ and
$\mathbf{z}=\left(z_{1},z_{2},z_{3}\right)$ can respectively be described by
the kets
$\bigl{|}Y\bigr{\rangle}=\bigl{|}y_{1}\bigr{\rangle}\times\bigl{|}y_{2}\bigr{\rangle}\times\bigl{|}y_{3}\bigr{\rangle}$
and
$\bigl{|}Z\bigr{\rangle}=\bigl{|}z_{1}\bigr{\rangle}\times\bigl{|}z_{2}\bigr{\rangle}\times\bigl{|}z_{3}\bigr{\rangle}$,
where $\bigl{|}y_{k}\bigr{\rangle}=y_{k}\bigl{|}0\bigr{\rangle}$ and
$\bigl{|}z_{k}\bigr{\rangle}=z_{k}\bigl{|}0\bigr{\rangle}$, $\forall
k\in\left\\{1,2,3\right\\}$.

  * •

Thirdly, the linear and nonlinear mappings of the ANN can respectively be
described in 1-APC by a linear operator $\widehat{\mathrm{M}}$ (whose matrix
representation must be the $M$-matrix used to transform $\mathbf{x}$ into
$\mathbf{y}$) and a nonlinear operator $\widehat{\mathrm{F}}$ connecting the
kets $\bigl{|}X\bigr{\rangle}$, $\bigl{|}Y\bigr{\rangle}$,
$\bigl{|}Z\bigr{\rangle}$ via the expressions
$\bigl{|}Y\bigr{\rangle}=\widehat{\mathrm{M}}\bigl{|}X\bigr{\rangle}$ and
$\bigl{|}Z\bigr{\rangle}=\widehat{\mathrm{F}}\bigl{|}Y\bigr{\rangle}=f\left(y_{1}\right)\bigl{|}0\bigr{\rangle}\times
f\left(y_{2}\right)\bigl{|}0\bigr{\rangle}\times
f\left(y_{3}\right)\bigl{|}0\bigr{\rangle}$.

### 5.3 Quantum computation

As expected, APC is also able to describe the mathematical model of QC, but
only partially. It is worth mentioning that there are some fundamental
concepts of the qubit and its basic operations that cannot be modelled with
APC since it is a computing theory whose unit of information is implemented by
classical waves. In order to clarify these concepts, let us take a closer look
at the unit of information and basic operations of QC.

##### Unit of information: the qubit.

An arbitrary state of a qubit is described by a ket of the form [22]:

$\bigl{|}\psi\bigr{\rangle}=\cos\frac{\theta}{2}\bigl{|}0\bigr{\rangle}+e^{i\varphi}\sin\frac{\theta}{2}\bigl{|}1\bigr{\rangle},$
(137)

with 2 EDFs ($\theta$ and $\varphi$) and a constant norm
$\left\|\psi\right\|^{2}=\bigl{\langle}\psi|\psi\bigr{\rangle}=1$. Given that
an anbit has more EDFs than a qubit, we can use the former to describe the
latter by setting a constant norm equal to $1$ and using quantum waves to
implement the anbit amplitudes.

As commented in the paper, the main differences between both units of
information are associated to the measurement, the description of multiple
units of information and the entanglement of units of information:

  * •

_Measurement_. In quantum mechanics, the wave function collapse makes an ideal
quantum measurement a _non-reversible_ operation in QC [10, 22]. It is
impossible to reconstruct the information encoded by the EDFs of a pre-
measurement qubit from the state of a post-measurement qubit. In contrast, in
APC, a measurement is always a _reversible_ operation because the number of
EDFs is preserved, see Supplementary Note 1 on p. 1.2 Anbit measurement. The
information encoded by the EDFs of a pre-measurement anbit may be retrieved
from the state of the post-measurement anbit, regardless of whether a coherent
or differential measurement strategy is employed. Therefore, an ideal quantum
measurement cannot be described by the mathematical framework of APC.

  * •

_Multiple units of information_. While the description of multiple anbits can
be carried out using the tensor product or the Cartesian product in APC, the
description of multiple qubits must be exclusively performed via the tensor
product in QC. This composition rule is derived from the state postulate and
the measurement postulate of quantum mechanics [34]. However, it is direct to
infer that this remark does not impose any limitation on APC to describe
multiple qubits.

  * •

_Entanglement_. The entanglement of different qubits is possible thanks to the
non-local nature of quantum mechanics [22]. Unfortunately, this instantaneous
non-locality cannot be found in a deterministic physical theory, e.g., in
classical electromagnetism [35]. Although electromagnetic non-local media are
supported by Maxwell’s equations, the time response is causal, that is, there
is a time delay between the incident electric field strength
($\boldsymbol{\mathcal{E}}=\sum_{l}\mathcal{E}_{l}\hat{\mathbf{u}}_{l}$) and
the electric displacement
($\boldsymbol{\mathcal{D}}=\sum_{k}\mathcal{D}_{k}\hat{\mathbf{u}}_{k}$).
Here, it should be noted that the most general non-local linear constitutive
relation between $\boldsymbol{\mathcal{E}}$ and $\boldsymbol{\mathcal{D}}$ is
given by the expression (Einstein’s summation convention) [36]:

$\mathcal{D}_{k}\left(\mathbf{r},t\right)=\int_{-\infty}^{\infty}\int_{-\infty}^{t}\varepsilon_{kl}\left(\mathbf{r},\mathbf{r}^{\prime},t,t^{\prime}\right)\mathcal{E}_{l}\left(\mathbf{r}^{\prime},t^{\prime}\right)\mathrm{d}t^{\prime}\mathrm{d}^{3}r^{\prime},$
(138)

where $\varepsilon_{kl}$ is the electric permittivity tensor. Specifically,
the time integral precludes instantaneous non-local effects in classical
electromagnetism. Consequently, the quantum entanglement cannot be described
by APC given that its technological PIP implementation is based on classical
electromagnetic waves.

##### Basic qubit operations.

The basic operations of QC are single-qubit gates and controlled qubit gates.
Interestingly, the mathematical framework of APC is able to describe all these
operations. A single-qubit gate is mathematically equivalent to a single-anbit
U-gate and the theoretical formalism of a controlled anbit gate is the same as
that of a controlled qubit gate (as commented on p. 65). In addition, taking
into account that any qubit logic gate may be composed from single-qubit gates
and controlled qubit gates [22], we infer that a multi-qubit operation can
also be described by APC. Nonetheless, any quantum operation exploiting the
non-local nature of quantum mechanics cannot be emulated with APC.

##### Conclusion.

APC is able to _partially_ describe the mathematical (and physical) model of
QC given that the ideal quantum measurement and the quantum entanglement have
no classical analogy in our computation theory, as discussed above.
Nevertheless, APC might be regarded as a potential theoretical and didactic
toolbox (implementable with current technology) that could improve our
comprehension about the subtle (but essential) differences between quantum and
classical systems.

## References

  * [1] Okamoto, K. _Fundamentals of Optical Waveguides_. 2nd ed. (Elsevier, London, 2006).
  * [2] Winzer, P. J. & Essiambre, R.-J. Advanced modulation formats for high-capacity optical transport networks. _J. Lightwave Technology_ 24, 4711 (2006).
  * [3] Chen, X., Macho, A. & Horche, P. R. Performance evaluation of 100 and 200-Gb/s WDM PM-QPSK transmission systems: tolerance analysis to the optical link impairments according to the optical carrier shape. _Optical Review_ 25, 663 (2018).
  * [4] Capmany, J. & Pérez, D. _Programmable Integrated Photonics_. (Oxford University Press, Oxford, 2020).
  * [5] Slepian, D. & Pollak, H. O. Prolate spheroidal wave functions, Fourier analysis and uncertainty-I. _Bell System Technical Journal_ 40, 43 (1961).
  * [6] Ho, K.-P. _Phase-Modulated Optical Communications Systems_. (Springer, New York, 2005).
  * [7] Kirillov, A. _An Introduction to Lie Groups and Lie Algebras_. (Cambridge University Press, Cambridge, 2008).
  * [8] Frankel, T. _The Geometry of Physics_. (Cambridge University Press, Cambridge, 2011).
  * [9] Landi, G. & Zampini, A. _Linear Algebra and Analytic Geometry for Physical Sciences_. (Springer, Cham, 2018).
  * [10] Cohen-Tannoudji, C., Diu, B. & Laloë, F. _Quantum Mechanics, Volume I: Basic Concepts, Tools, and Applications_. (Wiley, Weinheim, 2020).
  * [11] Rieffel, E. & Polak, W. _Quantum Computing: A Gentle Introduction, Ch. 3_. (The MIT Press, Massachusetts, 2011).
  * [12] Roman, S. _Advanced Linear Algebra_. (Springer, New York, 2005).
  * [13] Golub, G. H. & Van Loan, C. F. _Matrix Computations_. (The Johns Hopkins University Press, Baltimore, 2013).
  * [14] Jalas, D. _et al_. What is - and what is not - an optical isolator. _Nature Photonics_ 7, 579 (2013).
  * [15] Caloz, C. _et al_. Electromagnetic nonreciprocity. _Physical Review Applied_ 10, 047001 (2018).
  * [16] Pérez, D., Gasulla, I., DasMahapatra, P. & Capmany, J. Principles, fundamentals and applications of programmable integrated photonics. _Advances in Optics and Photonics_ 12, 709 (2020).
  * [17] Pérez, D. & Capmany, J. Scalable analysis for arbitrary photonic integrated waveguide meshes. _Optica_ 6, 19 (2019).
  * [18] Macho, A., Pérez, D. & Capmany, J. Optical implementation of 2$\times$2 universal unitary matrix transformations. _Laser & Photonics Reviews_ 15, 2000473 (2021).
  * [19] Mostow, G. D. Some new decomposition theorems for semi-simple groups. _Memoirs of the American Mathematical Society_ 14, 31 (1955).
  * [20] Nielsen, F. & Bhatia, R. _Matrix Information Geometry_. (Springer, Berlin, 2012).
  * [21] Hall, B. C. _Lie Groups, Lie Algebras, and Representations_. (Springer, New York, 2003).
  * [22] Nielsen, M. A. & Chuang, I. L. _Quantum Computation and Quantum Information_. (Cambridge University Press, Cambridge, 2016).
  * [23] Pérez, D., López, A., Dasmahapatra, P. & Capmany, J. Multipurpose self-configuration of programmable photonic circuits. _Nature Communications_ 11, 6359 (2020).
  * [24] Scarani, V., Iblisdir, S., Gisin, N. & Acín, A. Quantum cloning. _Reviews of Modern Physics_ 77, 1225 (2005).
  * [25] Reck, M., Zeilinger, A., Bernstein, H. J. & Bertani, P. Experimental realization of any discrete unitary operator. _Physical Review Letters_ 73, 58 (1994).
  * [26] Clements, W. R., Humphreys, P. C., Metcalf, B. J., Kolthammer, W. S. & Walmsley, I. A. Optimal design for universal multiport interferometers. _Optica_ 3, 1460 (2016).
  * [27] Agrawal, G. P. _Nonlinear Fiber Optics_. (Elsevier, Oxford, 2013).
  * [28] Sato, T. & Enokihara, A. Ultrasmall design of a universal linear circuit based on microring resonators. _Optics Express_ 27, 33005 (2019).
  * [29] Lanyon, B. P. _et al_. Simplifying quantum logic using higher-dimensional Hilbert spaces. _Nature Physics_ 5, 134 (2009).
  * [30] Wakerly, J. F. _Digital Design: Principles and Practices_. (Pearson, New Jersey, 2006).
  * [31] Desurvire, E. _Classical and Quantum Information Theory: An Introduction for the Telecom Scientist_. (Cambridge University Press, Cambridge, 2009).
  * [32] Mohamed, K. S. _Neuromorphic Computing and Beyond_. (Springer, Cham, 2020).
  * [33] Cartlidge, E. Optical neural networks. _Optics & Photonics News_ 6, 34 (2020).
  * [34] Carcassi, G., Maccone, L. & Aidala, C. A. Four postulates of quantum mechanics are three. _Physical Review Letters_ 126, 110402 (2021).
  * [35] Popescu, S. Nonlocality beyond quantum mechanics. _Nature Physics_ 10, 264 (2014).
  * [36] Mikki, S. M. & Kishk, A. A. Nonlocal Electromagnetic Media: A Paradigm for Material Engineering. In _Passive Microwave Components and Antennas_ (ed. Zhurbenko, V.) 73-94 (InTech, Rijeka, 2010).