1. A method of sampling a test signal, the method comprising: acquiring training signals sampled at a plurality of sampling locations; running an optimization procedure for determining an index set of n indices, representing a subset of the sampling locations, that maximize a function, over at least some of the training signals, of a quality parameter representing how well a given training signal is represented by the n indices; and sampling the test signal at the sampling locations represented by the n indices.