1. A method of sampling a test signal in magnetic resonance imaging system, the method comprising: acquiring training signals sampled at a plurality of sampling locations of a plurality of test subjects using a sampler configured to sample the training signals; 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 of a single test subject during a magnetic resonance imaging test at only the sampling locations represented by the n indices using the sampler, wherein the optimization procedure maximizes an average of the quality parameters of the training signals by solving an optimization problem of the type: Ω ^ = arg ⁢ ⁢ max Ω ∈ 𝒜 ⁢ ∑ j = 1 m ⁢ q ⁡ ( x j , x ^ j ⁡ ( Ω ) ) , where m is the number of training signals x, {circumflex over (x)} is a training signal estimate, q(x j , {circumflex over (x)} j (Ω)), is the quality parameter, ⊆{Ω: |Ω|=n} is a cardinality-constrained subset of {1,. .. , p} in which the selected index set is assumed to lie, and p is a dimension of the test signal, or the optimization procedure maximizes a minimum of the quality parameters of the training signals by solving an optimization problem of the type: Ω ^ = arg ⁢ ⁢ max ⁢ Ω ∈ 𝒜 ⁢ ⁢ min j = 1 , … , ⁢ m ⁢ q ⁡ ( x j , x ^ j ⁡ ( Ω ) ) .