Given (r1,r2,...rn) ∈ Rn, for any I=(I1,I2,...In) ∈ Zn, let EI=(eij), where eij=(ri−rj)−(Ii−Ii), find I ∈ Zn such that ∥EI∥ is minimized, where ∥·∥ is a matrix norm. This is a matching problem where, given a real-valued pattern, the goal is to find the best discrete pattern that matches the real-valued pattern. The criterion of the matching is based on the matrix norm minimization instead of simple pairwise distance minimization. This matching problem arises in optimal curve rasterization in computer graphics and in vector quantization of data compression. Until now, there has been no polynomial-time solution to this problem. We present a very simple O(nlgn) time algorithm to solve this problem under various matrix norms.