Correcting a mask pattern includes accessing the mask pattern segmented
into segments. An attribute value is established for each segment, where
the attribute value for a segment describes an attribute of the segment.
The following is repeated for one or more of the attribute values to
generate a corrected mask pattern: selecting segments using one or more
attribute values; calculating a current correction value for each of the
selected segments with respect to previously selected segments updated
according to previously calculated correction values; and updating the
selected segments according to the current correction values.