Matrix decomposition method, system, storage medium and device
Through the matrix decomposition method of Givens transform and multi-core parallel computing, the problem of low efficiency of DSP matrix decomposition is solved, and efficient parallel computing is achieved, which is suitable for computationally intensive and data-intensive processing in industrial scenarios.
Patent Information
- Application Number
- CN202510662826.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-22
- Publication Date
- 2025-09-26
AI Technical Summary
In the existing technology, the DSP-based matrix decomposition method is inefficient and cannot meet the growing solution scale and parallel efficiency requirements in industrial scenarios.
Givens transform is used for matrix decomposition, and the iterative process is controlled by judging the convergence. Multi-core parallel computing is used, combined with cyclic methods such as Caterpillar-Track sequence, odd-even sequence or Round-Robin sequence to determine the number of iterations and realize parallel computing of matrix blocks.
It provides efficient parallel computing means, which is concise and efficient. It is suitable for real-time processing scenarios with intensive computing, data intensive or network intensive, and supports applications such as eigenvalue problems and deep neural networks.
Smart Images

Figure CN120705562A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a matrix decomposition method, system, storage medium and device. Background Art
[0002] Singular value decomposition is a crucial component of scientific numerical computing and plays a vital role in many disciplines. In recent years, with the rapid development of various industries, the amount of data in existing industrial scenarios has exploded. Traditional algorithms and serial solutions can no longer meet the growing demands of various industries. Traditional industries such as energy exploration and weather forecasting, as well as emerging mathematically based algorithms such as artificial intelligence and deep learning, are also increasing their demand for computing power, and the need for solution scale and parallel efficiency is also increasing. Many artificial intelligence methods based on SVD decomposition also require SVD to solve eigenvalues and eigenvectors. How to accurately and efficiently perform matrix eigenvalue decomposition is also a hot topic in academia and engineering.
[0003] Digital signal processors (DSPs) offer advantages such as flexibility, stability, repeatability, and strong real-time performance. DSP-based multi-core parallelism allows for rapid multi-core execution of tasks in blocks, making them widely used in various industrial scenarios. Efficient matrix eigenvalue decomposition based on DSPs holds great promise in industrial applications, but its efficiency often falls short of meeting application requirements. Summary of the Invention
[0004] To overcome the deficiencies of the prior art, the present invention provides a matrix decomposition method, system, storage medium and device to solve the problems of low efficiency and other issues existing in the prior art.
[0005] The technical solution adopted by the present invention to solve the above problems is:
[0006] A matrix decomposition method is used to decompose the matrix based on Givens transformation.
[0007] As a preferred technical solution, the following steps are included:
[0008] A1, Givens transformation: perform Givens transformation on the matrix to be decomposed;
[0009] A2, judgment: judge whether the matrix after Givens transformation converges by performing convergence judgment; if so, end; otherwise, return to step A1.
[0010] As a preferred technical solution, step A1 includes the following steps:
[0011] A11, prepare the data matrix A to be decomposed; where A∈ m×n , C represents a complex number, m represents the number of rows of the matrix, and n represents the number of columns of the matrix;
[0012] A12, based on the total number of columns of the data matrix A and the total number of cores k+1, determines the total number of update iterations t, and starts a loop 1<=i<=t; where i represents the update iteration number, and t represents the total number of update iterations;
[0013] A13, distributes the data matrix A to cores 1 to k through core 0, and the distributed matrix blocks are denoted as A1-i, A2-i, ..., Ak-i in sequence;
[0014] A14, sequentially calculating the right Givens transform matrix of the matrix block based on the kernel order, wherein the kernel order includes: the first kernel corresponds to A1-i, the second kernel corresponds to A2-i, ..., and the kth kernel corresponds to Ak-i;
[0015] A15, updates the target columns of the corresponding matrix blocks in sequence based on the kernel order;
[0016] S16, returning the updated matrix block to the 0 core summary, and determining whether i <= t; if so, i = i + 1, and returning to step A13; if not, proceeding to step A2.
[0017] As a preferred technical solution, in step A12, one or more cycles of Caterpillar-Track sequence, parity sequence, Round-Robin sequence, and ring sequence are used to determine the total number of update iterations t.
[0018] As a preferred technical solution, in A14, the kernel order is used to calculate the right Givens transformation matrix of any two columns in the matrix block corresponding to the target kernel.
[0019] As a preferred technical solution, in A15, the k-th core is used to update the two target columns of Ak-i, wherein the two target columns correspond to the two columns selected in A14.
[0020] As a preferred technical solution, in step A2, the convergence is judged based on: the modulus of the non-diagonal position elements is <1e-5, where 1e-5 is selectively adjusted according to the hardware.
[0021] A matrix decomposition system, used to implement the matrix decomposition method, includes the following modules connected in sequence:
[0022] Givens transformation module: used to perform step A1;
[0023] Judgment module: used to execute step A2.
[0024] A matrix decomposition storage medium stores a program for running a matrix decomposition method.
[0025] A matrix decomposition device comprises the aforementioned matrix decomposition storage medium.
[0026] Compared with the prior art, the present invention has the following beneficial effects:
[0027] 1. This invention provides a basic parallel computing method, which is easy to call, simple and efficient
[0028] 2. The process of the present invention can be split to make application contributions to other matrix decompositions;
[0029] 3. The present invention is particularly applicable to application scenarios involving real-time processing such as computation-intensive, data-intensive or network-intensive. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 This is a flow chart of a matrix decomposition method according to the present invention;
[0031] Figure 2 This is a specific flowchart of the givens transformation within a single core in the process of the present invention;
[0032] Figure 3 Decomposition and merging of data streams for eigendecomposition of large matrices;
[0033] Figure 4 This is a structural diagram of a matrix decomposition system according to the present invention. DETAILED DESCRIPTION
[0034] The present invention will be further described in detail below with reference to the embodiments and the accompanying drawings, but the embodiments of the present invention are not limited thereto.
[0035] Example 1
[0036] like Figures 1 to 4 As shown, the present invention proposes a matrix decomposition method using a DSP parallel implementation architecture based on the Jacobi method for eigendecomposition of large matrices. This approach aims to provide a universal basic functional module applicable to DSP chips, offering a more convenient architecture for applications such as feature analysis and extraction in big data mining and matrix calculations in scientific computing. Furthermore, the present invention provides a MapReduce architecture for rapid decomposition and merging of data streams. Finally, the present invention provides a structural diagram of the relevant system, demonstrating good feasibility.
[0037] The object of the present invention is to fill the gaps in the prior art, provide a matrix decomposition method, expand the existing technical means, and have the advantages of strong applicability and high efficiency. The content of the present invention can provide a bottom-layer data processing tool for signal processing, structural mechanics, scientific computing, deep learning, and some cross-disciplinary application disciplines, and provide a method and module for the development of multiple disciplines and applications in multiple fields for the development and implementation of other functions.
[0038] Taking the classification in the image field as an example, matrix A is the matrix of various image data corresponding to a certain type of image. Each column of A represents a one-dimensional vector form converted from the gray value of an image. Assuming that the finally converged matrix is S, then S is the eigenvalue corresponding to this type of image matrix, that is, the transformation scale of the eigenvector. Then the intermediate decomposition process.
[0039] Ui = span(Trk)' * … * span(Tr2)' * span(Tr1)' is the eigenvector space of the i-th step corresponding to this type of image. Define TrSS := span(Trs). Then, according to the columns p and q corresponding to Trs, expand the 2×2 matrix Trs into the m×m scale identity matrix according to the corresponding rows and columns. TrSS(p, p) = Trs(1, 1), TrSS(p, q) = Trs(1, 2), TrSS(q, p) = Trs(2, 1), TrSS(q, q) = Trs(2, 2), and the elements in other diagonal places are 1, and the non-diagonal elements are 0. U = Ut *... * U2 * U1 represents the final eigenvector space, and each vector in it represents a basis function direction. Any such image can be linearly represented by these basis vectors. Other types of images cannot be linearly represented by these basis vectors, or the linear representation error is large.
[0040] A = [al, a2,..., ai,..., an]; ai = [ail; ai2;....; aij;....; aim], 1 ≤ i ≤ n;
[0041] Specifically, the value of aij (1 < j < m) represents the form of converting the image gray value (generally between 0 - 255) into a vector in the image, such as the image classification problems of animal pictures, plant pictures, etc.
[0042] The object of the present invention is achieved through the following solutions, including the following steps:
[0043] S100, prepare the data matrix A ∈ m×n , C represents complex numbers, m represents the number of rows of the matrix, and n represents the number of columns of the matrix;
[0044] S200, based on the total number of columns of matrix A and the total number of cores available for parallelization, a Caterpillar-Track sequence (an even-odd sequence, a Round-Robin sequence, a ring sequence, etc.) is used to cyclically determine the total number of update iterations t, and a loop is started where 1<=i<=t;
[0045] S300, distribute A to cores 1 to k through core 0, and the distributed matrix blocks are recorded as A1-i, A2-i, ..., Ak-i;
[0046] S400, sequentially calculating a right Givens transformation matrix of the matrix block based on a kernel order, wherein the kernel order includes: the first kernel corresponds to A1-i, the second kernel corresponds to A2-i, ..., and the kth kernel corresponds to Ak-i;
[0047] Specifically, the method includes: using the kernel order to calculate the right Givens transformation matrix of any two columns in the matrix block corresponding to the target kernel.
[0048] Exemplarily, the kth core is used to calculate the right Givens transformation matrix Tr(1+k) of any two columns in A(k+1)-i, where there are k+1 cores in total, and the 0 core, i.e., the assigned task, can also participate in subsequent calculations.
[0049] The specific implementation of S400 includes:
[0050] S400-1, the first core pair A1-i, calculates the right Givens transformation matrix Tr1 of any two internal columns; S400-2, the second core pair A2-i, calculates the right Givens transformation matrix Tr2 of any two internal columns; S400-3, the kth core pair Ak-i, calculates the right Givens transformation matrix Trk of any two internal columns; S500, updates the target columns of the corresponding matrix blocks in sequence based on the core order;
[0051] Specifically, it includes: using the kth core to update the two columns of the target column Ak-i, wherein the two columns of the target column correspond to the two columns selected in S400.
[0052] The specific implementation of S500 includes:
[0053] S500-1, the first core updates some columns of A1-i;
[0054] S500-2, the second core updates some columns of A2-i;
[0055] S500-3, the kth core updates part of the columns of Ak-i;
[0056] S600, after updating A1-i, A2-i, ..., Ak-I, return the 0 core summary, and determine whether i <= t. If so, i = i + 1 and return to S300. If not, enter S700;
[0057] S700, determine whether the off-diagonal elements converge. If so, end. If not, return to S200 and start the loop.
[0058] Furthermore, in order to give a detailed description of the in-kernel implementation of the present invention, we also give a detailed process of the Givens transformation within a single kernel after partitioning.
[0059] Furthermore, this solution involves data segmentation, computational processing, and merging. We combined the operation mode of MapReduce to first decompose the matrix and map it to different cores. Then, each core performs computational transformations and then merges the data together for fast and efficient processing.
[0060] In addition, in order to achieve the above object, the present invention further provides an implementation device, comprising:
[0061] Givens transformation module, which performs Givens transformation on the (data matrix) double diagonal matrix;
[0062] The judgment module judges whether the matrix after Givens transformation has converged.
[0063] The beneficial effects of the present invention include:
[0064] (1) The present invention provides a basic parallel computing method:
[0065] For general matrices, this method can quickly calculate the corresponding eigenvalues and eigenvectors. The relevant modules can be encapsulated and used as a fixed basic functional module for scientific computing and artificial intelligence. It can be called at any time, which is convenient, simple and efficient.
[0066] (2) The process of the present invention can be split to make application contributions to other matrix decompositions:
[0067] The present invention mainly involves a type of transformation (Givens transformation). The present invention modularizes and splits this type of transformation. Other matrix decompositions (such as QR decomposition) can independently call one of the transformation modules to achieve specific functions.
[0068] (3) The present invention is particularly applicable to real-time processing scenarios such as computationally intensive, data intensive, or network intensive:
[0069] Supported algorithms include but are not limited to eigenvalue problems, deep neural networks (DNN), low-rank subspace clustering (LRR), principal component analysis (PCA), convolutional neural networks (CNN), etc.
[0070] Example 2
[0071] like Figures 1 to 4 As shown, as a further optimization of Example 1, this example provides a more detailed implementation method.
[0072] See Figure 2 The specific flow chart of the givens transformation inside a single core is shown as follows:
[0073] S1: for K=1: s and matrix A_1;
[0074] S2: Give the right Givens transform Tr_K;
[0075] S3: Update A_1(:, [pk, qk]) of A_1 matrix;
[0076] S4: Determine if k≤S, if so, return to step S2, otherwise end the loop.
[0077] See Figure 3 This involves data set sharding and merging operations, so here we use the data-driven model of MapReduce, combined with the Caterpillar-Track sequence and the total number of cores. By slicing the matrix and mapping it to different cores, and then performing the corresponding Givens transformation within the cores separately, the calculation results of each core are merged and summarized together after completion, which speeds up the data processing architecture and improves efficiency.
[0078] like Figure 4 As shown, the system proposed in the embodiment of the present invention includes:
[0079] Givens transformation module, used to perform Givens transformation on matrices;
[0080] The judgment module is used to judge whether the matrix after each round of Givens transformation meets the convergence requirements;
[0081] The convergence criterion is that the modulus of the non-diagonal elements is less than 1e-5 (which can be selectively adjusted based on the specific hardware).
[0082] Other embodiments or specific implementations of the matrix decomposition method, system, storage medium and device of the present invention can refer to the above-mentioned method and real-time examples, which will not be repeated here.
[0083] The present invention is not limited to real matrices or square matrices, but can support complex matrices of any size. Its application is not limited to a single algorithm. All practical operations involving solving matrix eigenvalues and eigenvectors can directly call the methods and modules of the present invention, which is convenient and efficient. Any information not fully described in this specification is well known to those skilled in the art.
[0084] As described above, the present invention can be preferably implemented.
[0085] All features disclosed in all embodiments in this specification, or steps in all methods or processes implicitly disclosed, except for mutually exclusive features and / or steps, can be combined and / or expanded or replaced in any manner.
[0086] The above description is merely a preferred embodiment of the present invention and does not constitute any form of limitation to the present invention. Based on the technical essence of the present invention and within the spirit and principles of the present invention, any simple modification, equivalent replacement and improvement of the above embodiment shall still fall within the scope of protection of the technical solution of the present invention.
Claims
1. A matrix decomposition method, characterized in that: Matrix decomposition based on Givens transform.
2. A matrix decomposition method according to claim 1, characterized in that: The following steps are involved: A1, Givens transformation: perform Givens transformation on the matrix; A2, judgment: judge whether the matrix after Givens transformation converges by performing convergence judgment; if so, end; otherwise, return to step A1.
3. A matrix decomposition method according to claim 2, characterized in that: Step A1 includes the following steps: A11, prepare the data matrix A to be decomposed; where A∈ m×n , C represents a complex number, m represents the number of rows of the matrix, and n represents the number of columns of the matrix; A12, based on the total number of columns of the data matrix A and the total number of cores k+1, determines the total number of update iterations t, and starts a loop 1<=i<=t; where i represents the update iteration number, and t represents the total number of update iterations; A13, distributes the data matrix A to cores 1 to k through core 0, and the distributed matrix blocks are denoted as A1-i, A2-i, ..., Ak-i in sequence; A14, sequentially calculating the right Givens transform matrix of the matrix block based on the kernel order, wherein the kernel order includes: the first kernel corresponds to A1-i, the second kernel corresponds to A2-i, ..., and the kth kernel corresponds to Ak-i; A15, updates the target columns of the corresponding matrix blocks in sequence based on the kernel order; S16, returning the updated matrix block to the 0 core summary, and determining whether i <= t; if so, i = i + 1, and returning to step A13; if not, proceeding to step A2.
4. A matrix decomposition method according to claim 3, characterized in that: In step A12, the total number of update iterations t is determined using one or more cycles of a Caterpillar-Track sequence, an odd-even sequence, a Round-Robin sequence, and a ring sequence.
5. A matrix decomposition method according to claim 3, characterized in that: In A14, the kernel order is used to calculate the right Givens transformation matrix of any two columns in the matrix block corresponding to the target kernel.
6. A matrix decomposition method according to claim 5, characterized in that: In A15 , the k-th core is used to update the two target columns of Ak-i, where the two target columns correspond to the two columns selected in A14 .
7. A matrix decomposition method according to any one of claims 2 to 6, characterized in that: In step A2, convergence is determined by the modulus of the non-diagonal elements being less than 1e-5, where 1e-5 is selectively adjusted based on the hardware.
8. A matrix decomposition system, characterized in that: A matrix decomposition method for implementing any one of claims 2 to 7, comprising the following modules connected in sequence: Givens transformation module: used to perform step A1; Judgment module: used to execute step A2.
9. A matrix decomposition storage medium, characterized in that: A program for running a matrix decomposition method according to any one of claims 1 to 7 is stored.
10. A matrix decomposition device, characterized in that: Including the matrix decomposition storage medium as described in claim 9.
