A method of determining a phase value of an element of a spatial array of elements arranged to form a pixelated representation of a complex Fourier transform of a function, wherein each element comprises an amplitude value and a phase value, wherein the phase value is constrained to two possible phase values, the method comprising: measuring a first amplitude value for the element by performing an optical Fourier transform of the function and detecting light intensity at the element, wherein the step of measuring the first amplitude value comprises: displaying the function on a spatial light modulator ; illuminating the spatial light modulator to form spatially modulated light; and either: (i) Fourier transforming the spatially modulated light using a Fourier transform lens and detecting the intensity at the element using a photodetector placed at the Fourier plane of the Fourier lens; or (ii) detecting the intensity at the element in the optical far field using a photodetector, wherein the combination of a pixel size of the spatial light modulator and the distance between the photodetector and the spatial light modulator is chosen such that the Goodman criterion is satisfied; measuring a change in the first amplitude value of the element caused by applying a perturbation function to the function to form a perturbed function and displaying the perturbed function on the spatial light modulator, and determining the phase value based on the change in the first amplitude value. measuring a first amplitude value for the element by performing an optical Fourier transform of the function and detecting light intensity at the element, wherein the step of measuring the first amplitude value comprises: displaying the function on a spatial light modulator ; illuminating the spatial light modulator to form spatially modulated light; and either: (i) Fourier transforming the spatially modulated light using a Fourier transform lens and detecting the intensity at the element using a photodetector placed at the Fourier plane of the Fourier lens; or (ii) detecting the intensity at the element in the optical far field using a photodetector, wherein the combination of a pixel size of the spatial light modulator and the distance between the photodetector and the spatial light modulator is chosen such that the Goodman criterion is satisfied; displaying the function on a spatial light modulator ; illuminating the spatial light modulator to form spatially modulated light; and either: (i) Fourier transforming the spatially modulated light using a Fourier transform lens and detecting the intensity at the element using a photodetector placed at the Fourier plane of the Fourier lens; or (ii) detecting the intensity at the element in the optical far field using a photodetector, wherein the combination of a pixel size of the spatial light modulator and the distance between the photodetector and the spatial light modulator is chosen such that the Goodman criterion is satisfied; (i) Fourier transforming the spatially modulated light using a Fourier transform lens and detecting the intensity at the element using a photodetector placed at the Fourier plane of the Fourier lens; or (ii) detecting the intensity at the element in the optical far field using a photodetector, wherein the combination of a pixel size of the spatial light modulator and the distance between the photodetector and the spatial light modulator is chosen such that the Goodman criterion is satisfied; measuring a change in the first amplitude value of the element caused by applying a perturbation function to the function to form a perturbed function and displaying the perturbed function on the spatial light modulator, and determining the phase value based on the change in the first amplitude value. <EOS>