Inverse problems with nonnegative and sparse solutions: algorithms and application to the phase retrieval problem