A general solution to blind inverse problems for sparse input signals