# .

# Gerchberg-Saxton algorithm

The Gerchberg-Saxton Algortithm (*)

The Gerchberg-Saxton (GS) algorithm is an iterative algorithm for retrieving the phase of a pair of light distributions (or any other mathematically valid distribution) related via a propagating function, such as the Fourier transform, if their intensities at their respective optical planes are known.

It is often necessary to know only the phase distribution from one of the planes, since the phase distribution on the other plane can be obtained by performing a Fourier transform on the plane whose phase is known. Although often used for two-dimensional signals, the GS algorithm is also valid for one-dimensional signals.

The paper by R. W. Gerchberg and W. O. Saxton on this algorithm is entitled “A practical algorithm for the determination of the phase from image and diffraction plane pictures,” and was published in Optik (35, 237–246 1972).

The Pseudo-code below performs the GS algorithm to obtain a phase distribution for the plane, Source, such that its Fourier transform would have the amplitude distribution of the plane, Target.

**Pseudo-code algorithm
**

Let:

`FT - Forward Fourier Transform
IFT - Inverse Fourier Transform
i - the imaginary number, sqrt(-1) (square root of -1)
exp - exponential function (e^x)
Target and Source be the Target and Source Amplitude planes respectively
A, B, C & D be complex planes with the same dimension as Target and Source
Amplitude - Amplitde extracting function:
`

`eg. for complex z = x + iy, Amplitude(z) = sqrt(x*x + y*y)
`

`for real x, Amplitude(x) = |x|
`

`Phase - Phase extracting function:
`

`eg. Phase(z) = arctan(y/x)
`

`end Let
`

**Gerchberg–Saxton Algorithm**(Source, Target, Retrieved_Phase)

A = IFT(Target)

while error criterion is not satified

`B = Amplitude(Source) * exp(i*Phase(A))
C = FT(B)
D = Amplitude(Target) * exp(i*Phase(C))
A = IFT(D)
end while
`

`Retrieved_Phase = Phase(A)
end Gerchberg–Saxton Algorithm
`

This is just one of the many ways to implement the GS algorithm. Aside from optimizations, others may start by performing a forward Fourier Transform to the source distribution.

A projection from a Gerchberg-Saxton hologram (*)

**See also
**

* Fourier optics

* Holography

* Adaptive-additive algorithm

Retrieved from "http://en.wikipedia.org/"

All text is available under the terms of the GNU Free Documentation License