Optimum detection in presence of nonlinear distortions with memory