Optimal constrained representation and filtering of signals