1. A computer implemented method for writing data, the method comprising: receiving write data to be encoded into a write word; receiving constraints on symbol values associated with the write word; encoding the write data into the write word, the encoding comprising: representing the write data and the constraints as a first linear system in a first field of a first size; embedding the first linear system into a second linear system in a second field of a second size, the second size larger than the first size; solving the second linear system in the second field resulting in a solution; and collapsing the solution into the first field resulting in the write word, the write word satisfying the constraints on symbol values associated with the write word; and writing the write word to a memory.