View the code
This is a correlation-based optimal detector for a signal known exactly. See Green & Swets (1966) for more details.