Figure 2:
Reference implementation at the MIL.