## 1 Introduction  
Spectral detection methods such as infrared spectra, laser-induced breakdown spectra (LIBS), and Raman spectra are widely used in the fields of food safety [1], environmental monitoring [2], and medical diagnosis [3] as fast, convenient, and green methods. Quantitative and qualitative analyses are the two main aspects of spectral applications. Qualitative analysis involves classification and recognition of the spectra to be measured. Common recognition algorithms are mainly realized based on distance [4]. For example, the classic linear discriminant analysis (LDA) method takes the minimum within-class distance and the maximum between-class distances as criteria. However, spectral data is often a highly dimensional dataset with a small number of samples, and ordinary LDA cannot meet its classification requirements [5]. To enhance the classification characteristics, it is common practice to preprocessthe data by means of a data-conversion projection, such as principal component analysis-linear discriminant analysis (PCA-LDA) [6], partial least squares discriminant analysis (PLS-DA), and soft independent modeling of class analogy (SIMCA) [7], before recognition. This projects the principal component of the data into characteristic space, thereby reducing dimensionality. In addition, support vector machine (SVM) based on kernel function [8] projects limited data into a highly dimensional space, usually resulting in a better classification. However, a common problem with above algorithms is that it is tedious and cumbersome to select appropriate tuning parameters, such as the number of principal components in SIMCA, the number of latent variables in PLSDA, or the kernel function parameters and penalty factors in SVM, etc. Selection of these tuning parameters greatly affects the performance of the model. Apart from this, the optimal parameters vary to fit different data for different algorithms. If the optional range of optimal parameters is relatively large, the parameters will usually be dependent on the samples and the robustness of the algorithm suffers. Obviously, parameter selection by trial and error or empirical methods cannot be justified scientifically. Many algorithms, such as simple grid scanning method, genetic algorithm [9], and particle swarm algorithm [10], are available to exhaustively scan for and select the optimal parameters. However, these methods require cross-validation, which greatly affects computational efficiency. According to the principle of Occam's razor, it is better to have a simple algorithm with general applicability to different data (spectral data in this specific case) that is independent of the performance of parameter optimization. In other words, a better method should have not only a good performance, but it must also be insensitive to parameter selection for certain types of data. Sparse algorithms have previously been used for quantitative spectral analyses [11; 12], but these studies make improvements based on the framework of common quantitative analyses, such as partial least squares or ridge regression. LRSC algorithm, introduced in our study, is applied to the field of recognition, and its framework is completely different from those of the currently available algorithms. LRSC algorithm uses a simple linear regression representation framework [13] and conducts a compressed representation of the complete training set, utilizing a testing set to select samples in a training set that are most similar to the testing set. This simple method of representation not only contains the compressed sensing ideas, but it also overcomes the difficulty of working out the sparse solutions [14] by converting the problem into a convex optimization problem, similar to lasso [15; 16]. Additionally, according to the characteristics of spectral data, the algorithm's performance will not be overly reliant on the selection of the optimal parameters.