1. A method for decoding an [N,k] q sparse transform factor graph code using a soft- input cost function, comprising: a one-time initialization procedure; comprising: constructing a sparse transform factor graph representation of the code; selecting an encoding method consistent with the representation; selecting a message-passing decoder method consistent with the representation; initializing messages of the selected decoder method according to the soft-input cost function; and an iterative decoding procedure, comprising: updating messages according to message-update rules of the selected decoder; outputting a code word when a termination condition is true, and otherwise repeating the iteration of the decoding procedure.