The present invention concerns a method of sampling a test signal. The method comprises: acquiring (21) training signals sampled at a plurality of sampling locations; running (23) an optimization procedure for determining an index set of n indices, representing a subset of the sampling locations, that maximize a function, over the training signals, of a quality parameter representing how well a given training signal is represented by the n indices; and sampling (25) the test signal at the sampling locations represented by the n indices.