Topological optical differentiator

Optical computing holds significant promise of information processing with ultrahigh speed and low power consumption. Recent developments in nanophotonic structures have generated renewed interests due to the prospects of performing analog optical computing with compact devices. As one prominent example, spatial differentiation has been demonstrated with nanophotonic structures and directly applied for edge detection in image processing. However, broadband isotropic two-dimensional differentiation, which is required in most imaging processing applications, has not been experimentally demonstrated yet. Here, we establish a connection between two-dimensional optical spatial differentiation and a nontrivial topological charge in the optical transfer function. Based on this connection, we experimentally demonstrate an isotropic two-dimensional differentiation with a broad spectral bandwidth, by using the simplest photonic device, i.e. a single unpatterned interface. Our work indicates that exploiting concepts from topological photonics can lead to new opportunities in optical computing.

O ptical computing, which exploits the propagation of light for computing purposes, has been of interests for many decades due to the potential of performing computation at high speed and low power consumption 1,2 . In particular, Fourier optics setups have been widely explored for performing many of the computations that are useful for image processing [3][4][5][6] . These setups, however, are generally rather bulky. In recent years, there is a renewed interest in optical computing thanks to the developments of on-chip silicon photonic circuits and nanophotonic structures, which enable optical computing with devices that are far more compact compared with their conventional counterparts [7][8][9][10][11][12] .
A prominent example of optical computing is the spatial differentiation operation, which is useful for edge detection in image processing 13 . There have been substantial efforts in the past several years on the theoretical design of various nanophotonic structures for spatial differential operation in either one [14][15][16][17][18][19][20][21][22][23][24] or two dimensions [25][26][27][28] . Most of the experimental demonstrations, however, are restricted to one-dimensional differentiation [29][30][31][32][33][34][35][36][37] . There are two recent reports of two-dimensional differentiation using a photonic crystal structure 38 and a multilayer absorber 39 . However, the photonic crystal differentiator does not provide an isotropic operation, since doing so requires an elaborated design of the structure 25 . Furthermore, both of the methods operate only in a relatively narrow spectral bandwidth, since they both rely upon the use of optical resonances.
In this paper, we show that some of the concepts in the field of topological photonics can be applied in optical computing for the purpose of achieving broadband isotropic two-dimensional differentiation. To achieve two-dimensional differentiation, by the definition of differential operator, the transfer function of the device should exhibit an isolated zero in the wavevector space. Since the transfer function is in general complex, such an isolated zero should generically carry a topological charge 40 . Here we show that such a topological charge of ±1 can be straightforwardly achieved in a cross-polarization setup of reflection at a dielectric interface. Moreover, an isotropic transfer function with such a topological charge can be generated by adjusting experimental parameters. As a result, we provide an experimental realization of isotropic two-dimensional differentiation over a broad spectral band based on mere reflection from a flat surface. Different from the work which uses topological states for onedimensional transfer functions 11 , we directly construct a topological charge in two-dimensional transfer functions to engineer the functionality of device.

Results
Theory. Our setup is based on reflecting an incident polarized beam from a flat surface and subsequently analyzing the reflected beam with a polarizer, as schematically shown in Fig. 1. We define the beam profile in terms of coordinates x and y that are perpendicular to the beam propagation direction, with axes x and y being parallel and orthogonal to the plane of incidence, respectively. For an incident (reflected) plane wave propagating along the beam propagation direction, its electric field components along the x (−x) and y directions correspond to the p and s polarizations, respectively. In the paraxial regime, the incident beam has the form e in S in x; y ð Þ, where a 2-vector e in in the x-y plane describes the input polarization, and S in x; y ð Þ describes the scalar electric field distribution on the plane perpendicular to the beam propagation direction. By the spatial Fourier transform, the incident field can be decomposed into spatial frequency components through where all wavevector components have the same polarization e in . Because of the continuous condition of the tangential wavevector along the interface, the incident spatial frequency component with ðk x ; k y Þ in the incident plane only generates the reflected spatial frequency component with the same ðk x ; k y Þ in the output plane. At each ðk x ; k y Þ, the reflected wave has an electric field where Rðk x ; k y Þ is a 2 × 2 matrix. In general, the reflected waves can have different polarizations at different wavevectors. The reflected beam passes through a polarizer selecting an output polarization e out , resulting in an output electric field E out ¼ e out S out x; y ð Þ, where S out x; y ð Þ is a scalar field that describes the field distribution on the output plane, which is perpendicular to the propagation direction of the reflected beam. Here, we note that the coordinates x and y for S in x; y ð Þ and S out x; y ð Þ are defined in the reference planes for the incident and reflected beams, respectively. Similar to Eq. (1), we denotẽ S out ðk x ; k y Þ as the spatial Fourier spectrum of S out x; y ð Þ. The entire reflection process is then described bỹ S out ðk x ; k y Þ ¼ rðk x ; k y ÞS in ðk x ; k y Þ, where the scalar transfer function rðk x ; k y Þ ¼ e y out Rðk x ; k y Þe in . In this case, based on the reflection-induced k-dependent polarization variation, our setup performs nonlocal spatial filtering.
In order to achieve edge detection, we require that S out x; y ð Þ ¼DS in x; y ð Þ, whereD is a differential operator. For example,D can be a Laplacian 38 ,D ¼ ∂ 2 x þ ∂ 2 y , corresponding to a transfer function rðk x ; k y Þ ¼ k 2 x þ k 2 y in the wavevector space. However, a wide variety of other differential operators can also be used for edge detection purposes. By definition, in order to achieve differential operations, the transfer functions has to have rðk x ¼ 0; k y ¼ 0Þ ¼ 0. (Here k x = k y = 0 corresponds to the direction of the beam propagation, with an incident angle θ 0 .) In our setup, one can straightforwardly achieve rðk x ¼ 0; k y ¼ 0Þ ¼ 0 by choosing the appropriate input and output polarizations such that x y e in x y Fig. 1 Schematic of the experimental setup, where an incident beam with polarization e in is reflected by an interface, and then passes through a polarizer which selects a linear polarization with an orientation angle γ. This setup performs an isotropic two-dimensional spatial differentiation, and can generate an output beam with an orbital angular momentum of ±1 with an input Gaussian beam. x and y are the beam profile coordinates for the incident and reflected light, which share the same origin on the interface.
Below we refer to the condition of Eq. (3) as the crosspolarization condition. When this condition is satisfied, the transfer function in the vicinity of k x = k y = 0 has the generic form (Here, we use similar notations following those in ref. 34 , see detailed derivation in the Supplementary Note 1.): as can be obtained from Taylor expansion of rðk x ; k y Þ to its firstorder terms near k x = k y = 0. Since rðk x ; k y Þ is a complex scalar field, every loop c in the k x − k y space is associated with a winding number l ¼ 1 2πi H c dr r , which can only take integer values. l ≠ 0 implies that the loop c encloses at least one zero of rðk x ; k y Þ. Therefore, for every isolated zero of rðk x ; k y Þ, one can define its topological charge as the winding number of a loop that encloses only this particular zero. Since the winding number is an integer, it is topologically invariant. Any small continuous deformation of the system cannot change the topological charge of the zero. Suppose C y /C x = Ae iφ , where A ∈ R and φ 2 0; π ½ Þ, the zero of rðk x ; k y Þ has a topological charge l ¼ sgnðAφÞ.
Moreover, in order to achieve two-dimensional isotropic differentiation, the transfer function must have a rotationally invariant magnitude, and hence the coefficients C x and C y have to satisfy The transfer function then corresponds to a differential operator For a given input distribution S in x; y ð Þ, this operator results in the following output intensity distribution: Thus, this operator nonlocally calculates the squared gradient magnitude of the incident field and can be employed for isotropic edge detection in 2D images. We note that with Eq. (5), the transfer function has the form r(k x , k y ) ∝ e ±iϑ , where tan ϑ ¼ k y =k x , which shows that the zero of r(k x , k y ) has a topological charge of ±1. In contrast, the topologically trivial case, where C x and C y have the same phases, does not support the rotationally invariant response and can only perform onedimensional differentiation along certain orientation 34 . Therefore, there is a connection between the topological charge of the transfer function, and the operation of edge detection. This connection has not been previously recognized. All previous works 14-39 on spatial differentiation utilize a transfer function that has no topological charge. For ease of experimental implementation, we choose the output polarization to be a linear polarization with a normalized electric field Àsin γ; cos γ ð Þ T , as schematically shown in Fig. 1. Based on Eq. (3), the corresponding incident polarization e in can be determined as Here, r p0 and r s0 are the Fresnel reflection coefficients for p-and s-polarized plane waves at incident angle θ 0 , respectively, while ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi jr s0 cos γj 2 þ jr p0 sin γj 2 q is a normalization factor. C x and C y can thus be calculated as (see derivation in the Supplementary Note 1) where ∂r p s ð Þ =∂θ is the first-order derivative of the Fresnel reflection coefficient for p(s)-polarized plane wave with respect to the incident angle (θ) at θ 0 . To achieve an isotropic differentiation operation, for a given reflector, we combine Eqs. (9a) and (9b) with Eq. (5) to determine the required γ and θ 0 . Once these two parameters are determined, the input polarization is determined using Eq. (8). In this way, we can determine the parameters required for an isotropic edge detection.
We note that in order to achieve a nontrivial topological charge in rðk x ; k y Þ, r p and r s cannot be both real, since in this case C x and C y are also real numbers as can be seen in Eqs. (9a) and (9b). The nontrivial topological charge can be achieved with a wide variety of reflectors, for example lossy metallic reflectors, using photonic band gap effects, or using total internal reflection at a dielectric interface, since in all these cases r p and r s are complex with different phases. At a dielectric interface, below the critical angle of total internal reflection, the partial reflection on a dielectric interface cannot exhibit the topological charge in most cases since both r p and r s are real, except if one of the Fresnel reflection coefficients is zero which occurs at the Brewster angle where r p0 = 0. In this case, the cross-polarization condition [Eq. (3)] can be satisfied with an arbitrary input polarization e in ¼ ðe x in ; e y in Þ T . By setting γ = π/2, Eqs. (9a) and (9b) then become With either a circular or an elliptical input polarization, rðk x ; k y Þ exhibits a nontrivial topological charge and enables twodimensional differentiation, which, however, is anisotropic in most cases. Also, Eq. (5), which is required for isotropic differentiation, can be achieved with a correct choice of the input polarization. In this paper, we experimentally demonstrate isotropic edge detection by operating either with the total internal reflection (Fig. 2a) or at the Brewster angle (Fig. 2h).

Measurement of the transfer functions and topological charges.
For the total internal reflection configuration, light beam is incident from the glass side of an air-glass interface onto the base of a prism. Based on Eqs. (5), (9a) and (9b), and using light at the wavelength of 532 nm, we determine the angle of incidence θ 0 = 70.24 ∘ . In this case, we use an isosceles prism with 70.24 ∘ base angles (Fig. 2a) and send in light from air through the lateral side at normal incidence, such that the Goos-Hänchen and Imbert-Fedorov effects during the transmission can be neglected 41 . Specifically, we launch a Gaussian light beam from a laser at 532 nm through a linear polarizer and a subsequent quarter-wave plate to shape the input polarization, and select the output polarization with a second linear polarizer. Then, we acquire the magnitude squared of the output spatial spectrum by performing optical Fourier transform on the reflected light, which is measured by a CMOS camera (see setups in the Supplementary Note 2). By normalizing the magnitude of the output spatial spectrum with that of the incident one, we obtain the magnitude of the transfer function, i.e. jrðk x ; k y Þj.  Fig. 2b is measured with the output polarizer orientation γ = −π/4 and the input polarization e in ¼ ðr s0 ; r p0 Þ T = ffiffi ffi 2 p , as determined using Eqs. (5), (9a) and (9b) for the case of C y /C x = −i. Figure 2c is measured with output polarization orientation γ = +π/4 and incident polarization e in ¼ ðr s0 ; Àr p0 Þ T = ffiffi ffi 2 p , corresponding to the case of C y /C x = +i in Eqs. (9a) and (9b). In both Fig. 2b, c, the measured magnitudes of transfer functions are isotropic in the k x -k y plane, and exhibit isolated zeros at k x = k y = 0.
To demonstrate the topological charges associated with the isolated zeros, based on the setup for measuring the transfer functions, we use an additional divergent reference beam to interfere with the output beam (see setups in the Supplementary Note 2). Corresponding to the cases shown in Fig. 2b, c, respectively, the measured interference patterns in Fig. 2f, g indeed show spiral fringes. The clockwise (Fig. 2f) and As a quantitative evaluation of the isotropic behavior, we plot the jrðk x ; k y Þj along the k x = 0 and k y = 0 lines as a function of wavevector in Fig. 2d, e, corresponding to Fig. 2b, c, respectively. jrðk x ; k y Þj shows linear dependency as a function of magnitude of the wavevector, in agreement with Eq. (4). Moreover, the slopes of jrðk x ; k y Þj along the two lines agree with each other, as well as with the theoretical results as calculated using Eqs. (9a) and (9b). Figure 2i-n show the results when we operate at the Brewster angle. Figure 2h shows the schematic of the setup, where light is incident from the air side onto the air-glass interface. We set γ = π/2 and choose the input polarizations based on Eqs. (5), (10a) and (10b) for both cases of C y /C x = −i and C y /C x = +i. Similar to the total internal reflection case, the magnitudes of the resulting transfer functions are isotropic in the k x -k y plane with the isolated zeros at k x = k y = 0 (Fig. 2i-l). There are topological charges associated with the isolated zeros, as evidenced by the spiral interference patterns shown in Fig. 2m, n. The results in Fig. 2 indicate that we can indeed achieve the transfer function of Eq. (4), using either total internal reflection or by operating at the Brewster angle.

Demonstration of isotropic differentiation and edge detection.
We now experimentally demonstrate isotropic spatial differentiation using the transfer functions in Fig. 2. We focus on the cases with topological charges of −1. The effects from the cases with topological charges of +1 are similar. The transfer functions with topological charge −1 are shown in Fig. 2b when we use total internal reflection, and in Fig. 2i when we operate at the Brewster angle. Mathematically, the transfer functions should correspond to the differential operator in Eq. (6) with a minus sign.
We first consider the scenario where the input, as shown in Fig. 3a, d, are Gaussian beams. The operator in Eq. (6) with a minus sign, operating on a Gaussian beam, should produce a beam with an orbital angular momentum of −1, which possesses a donut-shaped intensity profile. We indeed observe such intensity profiles in the output beams, when we either use total internal reflection (Fig. 3b) or operate at the Brewster angle (Fig. 3e). In Fig. 3c, we show the intensity plots of the output beam as a function of position, along various directions that pass through the center of beam, for the case where we use total internal reflection. These plots strongly overlap with one another, indicating the isotropic differentiation. Similar isotropic behavior can be seen when we operate at the Brewster angle (Fig. 3f). For comparison, we also calculated and plot the ideal squared gradient magnitude of a Gaussian beam in both Fig. 3c, f. The experimental results coincide well with the calculated ones, indicating a great performance of the differentiation.
We now demonstrate the isotropic edge enhancement by directly incorporating our setup as part of an imaging system. Different from the Laplacians 38,39 , the proposed first-order differentiator is able to directly detect edges in images without the need for subsequent zero-crossing detection. Here we focus on the case where we use total internal reflection. The results from operating at the Brewster angle are very similar and not shown here. We first send a collimated laser beam through a binary mask and then use an imaging system to image the mask onto a CMOS camera (Fig. 4a). Figure 4b shows the input image of a Stanford logo, when we use a laser at the wavelength of 532 nm. Since our differentiator works as a nonlocal filter, it can be placed at any position in the object or image space. As shown in Fig. 4a, we incorporate the differentiator in the imaging system and thus have the input image differentiated (see details in the Supplementary Note 3). The corresponding output image is shown in Fig. 4c. We see that the output image consists of only the edges, and all edges appear in the image with similar magnitudes independent of their orientations. The image here provides a clear demonstration of the isotropic edge enhancement. Since we propose our design in the paraxial regime, it has a finite spatial bandwidth, which means it cannot resolve edges that are too close. In Fig. 4d, we show the output image when the input one consists of an array of full circles with gradually reducing diameters. The output image consists of circumferences . The intensity on the circular edges is quite uniform, which again points to the isotropic nature of the differentiation operation. The edges are clearly visible even for an input full circle with a diameter as small as 5 μm. Thus, the ability of the differentiation operation to resolve close edges here should be sufficient for most image processing applications.
In contrast to all previous works on using nanophotonic structures for spatial differentiation, in our scheme, the zero of the transfer function carries a topological charge. Hence the presence of zero cannot be removed by small perturbations. The only mechanisms to eliminate a zero are to merge two zeros with opposite charges so that they annihilate each other, or to move an isolated zero outside the light cone so that it becomes inaccessible from free space. As long as the isolated zero persists within the light cone, 2D differentiation can be achieved by aligning the incident wavevector with the wavevector at which the transfer function r vanishes. Therefore, there is a certain level of robustness of our device with respect to parameter variations. The level of robustness is defined by the strength of system variations that is required to eliminate a zero through the mechanisms mentioned above. We note that the robustness of the zero in the transfer function is a topological effect that does not require the system to have any symmetry.
Moreover, a highly important characteristic is that with the same experimental parameters, the differentiator can operate over a broad spectral band. Here the broadband nature also arises from the fact that the refractive index of glass does not vary significantly as a function of frequency. As an illustration of the broad spectral bandwidth, for the total internal reflection case, in Fig. 4h, i, we numerically calculate and show the magnitude and phase of the transfer function, respectively, at the wavelength of 410 nm. And in Fig. 4j, k, we show the same at the wavelength of 820 nm. In these plots, except the wavelengths, all other operating conditions, including the angle of incidence, the polarization of the incident light, and the orientation of the output polarizer, are kept the same. In spite of a change of factor 2 in operating frequencies, the normalized transfer functions in the two cases are very similar to each other. Here the small difference between the two arises from the small differences in the refractive index of glass at these two wavelengths. We note that the transfer functions at different wavelengths have different slopes with respect to k x and k y , thus the strength of the differentiation result is wavelength-dependent. Such wavelength dependency, however, can be easily calibrated in multispectral applications.
The above discussion indicates that this device can operate over a broad spectral band. As a direct illustration, Fig. 4e-g show the experimental results as Fig. 4b-d, except that we now use a laser at the wavelength of 632.8 nm, which has a red color. We observe near-identical performances at these two wavelengths. The operating spectral bandwidth here far exceeds all previous works on using photonic structures for two-dimensional spatial differentiation.

Discussion
In conclusion, we have established a connection between twodimensional optical spatial differentiation and a nontrivial topological charge in the optical transfer function. Based on this connection, we experimentally demonstrate broadband isotropic two-dimensional differentiation, by generating a nonzero topological charge with a cross-polarization setup of light reflection at an unpatterned interface. The nontrivial topological charge plays an essential role for the two-dimensional operation, since the topologically trivial case can only perform one-dimensional directional differentiation. We note that although we choose a linear output polarization for the ease of experiment, circular or elliptical output polarizations can also be used for the isotropic differentiation, and there is no longer the restriction of using total internal reflection or operating at the Brewster angle in these cases. We anticipate that similar setup can be used to generate nontrivial topological charges for other configurations of photonic structures. Moreover, it should be possible to use photonic structures in such setup to generally engineer nonlocal responses for other computational tasks. For example, higher-order differentiation may be achieved by generating multiple topological charges in the transfer function. We anticipate that exploitation of optical transfer functions with different nontrivial topological charge configurations can lead to new opportunities in achieving general and robust optical computing.

Data availability
The data that support the findings of this study are available from the corresponding author upon reasonable request.