Circuit design requires robustness to counteract undesirable variability, as typically seen e.g. in magnetic memory devices. Approximation to discrete structures is needed so that, on the one hand, the size of the structure is not too small where richer algebraic structures cannot be integrated, and, on the other hand, not too large so that variability makes practical application unfeasible.