Deep Dive into the OPU
======================
The optical operation in detail
-------------------------------
Independently of the details of the optical system, x and y should be considered as 1-D vectors.
The matrix-vector multiplication outputs a :math:`(1 \times m)` vector, complex-valued.
This is followed by the element-wise non-linearity :math:`\lvert . \rvert^2` and the quantization due to analog to
digital conversion.
Finally, the output of the OPU is :math:`\mathbf{y}` a column vector of size :math:`(1 \times m)` of type `uint8`.
The independence of the entries of the output vector means that the rows of the matrix R are independent.
The distribution of the random matrix
-------------------------------------
It is possible to write :math:`r=\mathbf{R}_{ij}` in the following way:
.. math::
r = u + iv, u \sim \mathcal{N}(0, \sigma^2), v \sim \mathcal{N}(0, \sigma^2)
The only parameter is a global gain: a multiplicative constant, that you may see as the variance of these distributions.
It depends on many physical parameters.
The binary input
----------------
The input device can only handle binary data.
For input data that is not binary to start with, you can use encoding schemes to transform any type of data into a
binary array. Some of these encoding schemes are fixed, but we also have a data-adaptive scheme based on an autoencoder.
Finally, there is also the possibility that users provide their own encoding function.
Understanding the output
------------------------
The output recorded by the output device is an interference pattern, called a speckle.
.. image:: ../_static/img/speckle_image_hist.png
:align: center
The histogram of a theoretical speckle is a decreasing exponential.