A transverse computer-generated hologram (CGH) diffracts and provides flexible control of incident light by steering it to any point in the projected image plane -i.e.CGHs are able to direct the light to where it is needed and away from where it is not 1 .In addition, the number of resolvable points in the image projection plane is a function of the CGH's pixel count 2 . Here we report a longitudinal CGH (LCGH), a photonic structure, which swaps the ability to steer light toward fixed spatial points for digital control in the frequency domain. This is of particular interest in the context of tunable lasers. In this regard, an LCGH offers two important degrees-of-freedom (DOFs): 1) provides high-resolution wavevector or k-space resolution within the Brillouin zone; 2) enables full control to define or modify the reflectivity at each resolvable k-point, so attaining a target spectral response. We demonstrate the flexibility of our LCGH approach by achieving purely electronic tuning between six digitally-selected operating frequencies in a single-section terahertz (THz) quantum cascade laser (QCL) 3 . These switchable single-frequency devices will simplify combining the power and flexibility of (Fig. 1d) enabling switching between these modes, i.e.electronically-controlled discrete tuning.In order to understand the first DOF, consider an LCGH of 2N pixels in the form of a spatial relative permittivity distribution ε(z), where L = NΛ is the total length and Λ the 3 minimum hologram-element separation. There exists an approximate FT relationship between ε(z) and the spectral reflectivity response ρ(k)18-20 :Due to the pixelated nature of the spatial domain z, the wavevector k is unique only over the interval (0,k B ), with a maximum N number of resolvable k-points resulting in a density of states Δk = (k B /N)(n eff /n g ) 21, 22 , where k B = π/n eff Λ is the wavevector corresponding to the edge of Brillouin zone, n eff is the effective modal refractive index, n g is the group refractive index All QCLs were fabricated from a molecular beam epitaxially grown GaAs/Al 0.15 Ga 0.85 As wafer, V557, with an 11.4 µm-thick active region based on reference 25. V557 was processed (Fig. 2 caption) into SP waveguides and cleaved into ~6 mm-long Fabry-Perot (FP) cavities.All devices displayed similar performance characteristics − as a typical example Fig. 2a shows the FP spectra of device A, recorded at four driving current densities. As expected, In order to generate the real-space lattice structure (i.e. the LCGH) satisfying ρ target , we exploit equation 1. The pixelated nature of the real-space allows this design to be implemented using a discrete FT, specifically a fast Fourier transform (FFT). Identifying an "optimised" LCGH architecture is computationally non-trivial, particularly when N is large.An FFT-based simulated annealing (SA) inverse optimisation algorithm was chosen, details 5 of which, including the number of optimisation parameters, are described in references 26and 27. The choice of algorithm is not critica...