Iterative calculation matrix inversion method and system based on Cholesky decomposition
Through the iterative calculation method based on Cholesky decomposition, the problem of high computing resource consumption in high-order matrix inversion operation is solved, and efficient calculation of matrix inversion and system performance is achieved.
Patent Information
- Application Number
- CN202411555384.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-04
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2044-11-04
AI Technical Summary
The prior art consumes a large amount of computing resources, has high computational complexity, and is difficult to meet the general data storage form of matrix multiplication, resulting in poor system performance.
The iterative calculation matrix inversion method based on Cholesky decomposition is adopted, and the upper triangular matrix and its inverse matrix are generated through iterative processing, and the storage form of the inverse matrix is converted into sequential storage, and the matrix multiplication module is multiplexed.
It reduces the computational complexity and resource consumption of matrix inversion, improves computing efficiency and system performance, supports multi-parallel calculation, and enhances the scalability of the system.
Smart Images

Figure CN119441699A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of DSP system optimization, and in particular to an iterative calculation matrix inversion method and system based on Cholesky decomposition. Background Art
[0002] With the rapid development of information technology, people have higher and higher requirements for data processing capabilities. In hot areas such as big data processing and artificial intelligence, the proportion of intensive computing tasks is increasing. Matrix operations are the core link of intensive computing, and their computing performance basically determines the overall performance of the system. As a typical matrix operation, matrix inversion has an increasing demand for supporting high-performance and high-order matrix computing.
[0003] Matrix inversion is computationally intensive and memory intensive. As the matrix order increases, the time, space, and computing resource costs required to support the inversion operation increase exponentially, which greatly restricts the inversion of high-order matrices. As a computationally intensive operation, the inversion of high-order matrices takes a lot of time to calculate. In addition, since in addition to storing the original matrix, additional space is required to store the intermediate results and the final inverse matrix, this may become a problem when memory is limited. For the above reasons, the performance of matrix inversion implemented in software is very poor in real-time work. Some researchers have tried to accelerate matrix inversion through FPGA (field programmable gate array). Since FPGA mainly performs calculations through lookup tables, the granularity is fine, and a large amount of resources are used for configurable on-chip routing and wiring, the utilization of computing resources is low.
[0004] Since hardware has the natural advantage of parallel computing, using ASIC (Application Specific Integrated Circuit) to accelerate matrix inversion can provide higher performance. In the traditional Cholesky decomposition, the elements of the matrix L can be obtained by the following recursive formula:
[0005]
[0006] The algorithm directly uses the formula for calculation, which requires multiplication and accumulation computing resources, and the calculation and addressing complexity are high, and the subsequent triangular matrix inversion also has the disadvantages of high computing resource requirements and high computing complexity. Therefore, the algorithm is limited to low-order matrices or specific-order matrices in matrix inversion. Therefore, reducing the computational complexity of matrix inversion, reducing the required computing resources, and improving the efficiency of matrix inversion calculation have become the key means to break the bottleneck of matrix inversion calculation. In addition, since matrix inversion calculation inevitably uses matrix multiplication, and the two source data matrices used in matrix multiplication usually need to be stored in SRAM according to the whole row (row-major order) and the whole column (column-major order) respectively, the storage form of the two matrices to be calculated obtained by the existing Cholesky inversion is single, which cannot meet the general data storage form of matrix multiplication. Only a special triangular matrix multiplication module can be designed inside the Cholesky inversion system, which does not have universality and cannot reuse a general matrix multiplication module. At the same time, in the current iterative processing Cholesky inversion method, it is necessary to allocate additional time for the two zero-filling operations in the Cholesky decomposition and triangular matrix inversion stages, which greatly reduces the performance of matrix inversion. Summary of the invention
[0007] In view of the deficiencies in the prior art, the present application discloses an iterative matrix inversion method and system based on Cholesky decomposition.
[0008] In a first aspect, the present application provides an iterative matrix inversion method based on Cholesky decomposition, which is used in a DSP system, comprising:
[0009] Obtain a target source matrix; wherein the target source matrix includes: an N-order conjugate positive definite matrix;
[0010] Based on Cholesky decomposition, performing a first iterative process on the target source matrix to generate an upper triangular matrix;
[0011] Performing a second iterative process on the upper triangular matrix to generate an inverse matrix of the upper triangular matrix;
[0012] Performing conjugate transposition processing on the inverse matrix of the upper triangular matrix to generate a lower triangular matrix; wherein the lower triangular matrix is stored in the form of whole column storage;
[0013] Converting the storage mode of the inverse matrix of the upper triangular matrix into a sequential storage form to reuse the matrix multiplication module in the DSP system;
[0014] Matrix multiplication is performed on the inverse matrix of the upper triangular matrix and the lower triangular matrix to generate the inverse matrix of the target source matrix.
[0015] As an optional implementation, generating an upper triangular matrix includes:
[0016] Performing a square root operation on the diagonal elements of the target source matrix and calculating the reciprocal thereof to determine the diagonal elements of the upper triangular matrix;
[0017] Performing a complex multiplication operation on the off-diagonal elements located after the diagonal elements in the Nth row of the target source matrix to update the off-diagonal elements of the upper triangular matrix;
[0018] Based on the upper triangular matrix elements, each element of the lower right rectangular area of the target source matrix is calculated and updated;
[0019] In response to completing N calculation updates, the first iterative process ends and the upper triangular matrix is generated.
[0020] As an optional implementation manner, generating the inverse matrix of the upper triangular matrix includes:
[0021] Performing a reciprocal operation on the diagonal elements of the upper triangular matrix to determine the diagonal elements of the inverse matrix;
[0022] Performing a complex multiplication operation on the non-diagonal elements above the diagonal elements in the Nth column of the upper triangular matrix to update the non-diagonal elements of the inverse matrix;
[0023] Based on the updated off-diagonal elements of the inverse matrix, each element in the upper right rectangular area of the upper triangular matrix is calculated and updated;
[0024] In response to completing N calculation updates, the second iterative process ends and an inverse matrix of the upper triangular matrix is generated.
[0025] As an optional implementation, generating a lower triangular matrix includes:
[0026] Based on a first preset order, taking out each element in the inverse matrix of the upper triangular matrix one by one;
[0027] Perform conjugate complex number calculation on each of the extracted elements;
[0028] Based on the second preset order, the elements after the conjugate complex number calculation are sequentially placed into the storage area of the lower triangular matrix.
[0029] As an optional implementation, the first preset order includes: taking out row by row; the second preset order includes: putting in column by column;
[0030] The row-by-row extraction includes: extracting each element from the first row of the inverse matrix of the upper triangular matrix from left to right in sequence; then, extracting elements from the second row from left to right in sequence; and continuing to process in the same order until all elements of all rows have been extracted;
[0031] The column-by-column placing includes: storing the elements after the conjugate complex number calculation in the storage area of the lower triangular matrix in order of columns;
[0032] The elements taken from the first row are stored in the first column of the lower triangular matrix in sequence;
[0033] The elements taken from the second row are stored in the second column of the lower triangular matrix in sequence;
[0034] Continue processing in the same order until all elements have been stored in their corresponding columns.
[0035] As an optional implementation, it also includes:
[0036] The area for storing matrix elements is SRAM, which consists of 64 banks, each bank is composed of 4 SRAM IPs with a width of 64 bits and a depth of 1024 bits. The splicing includes: depth splicing and width splicing.
[0037] The SRAM is divided into a plurality of partitions, including: a source data 1 area, a source data 2 area, a result area, and an intermediate result area; wherein each of the partitions is composed of 16 banks.
[0038] As an optional implementation, the inverse matrix of the upper triangular matrix is stored in a whole column format; wherein, each column element of the inverse matrix of the upper triangular matrix is stored in the same bank, the 1st and 2nd column elements are placed in bank1, the 3rd and 4th column elements are placed in bank2, and so on, the 15th and 16th column elements are placed in bank8, and then the 17th and 18th column elements are stored in bank1 again, forming a cycle;
[0039] The method of converting the storage mode of the inverse matrix of the upper triangular matrix into a sequential storage mode includes: for the inverse matrix of the upper triangular matrix stored in a whole column storage mode, starting to fetch numbers row by row, and filling them into 8 banks in sequence, the 1st and 2nd elements of the first row of the matrix are stored in bank1, the 3rd and 4th elements are stored in bank2, and so on, until the 15th and 16th elements are stored in bank8, and then the 17th and 18th elements are stored in bank1 again, forming a cycle.
[0040] As an optional implementation, the method further includes: performing a piecewise zero-padding operation on the row elements of the target source matrix; wherein when the elements of the row are located below the corresponding column, the corresponding non-diagonal elements in the row are set to zero;
[0041] When an element of a row is located on the diagonal or above the corresponding column, the off-diagonal elements of the row are calculated and updated to determine their values.
[0042] In a second aspect, the present application also provides an iterative matrix inversion system based on Cholesky decomposition, comprising: a matrix receiving module, a matrix decomposition module, a triangular matrix inversion module, a matrix transposition module, a storage conversion module and a matrix multiplication module; wherein,
[0043] The matrix receiving module is used to obtain a target source matrix; wherein the target source matrix includes: an N-order conjugate positive definite matrix;
[0044] The matrix decomposition module is used to perform a first iterative process on the target source matrix based on Cholesky decomposition to generate an upper triangular matrix;
[0045] The triangular matrix inversion module is used to perform a second iterative process on the upper triangular matrix to generate an inverse matrix of the upper triangular matrix;
[0046] The matrix transposition module is used to perform conjugate transposition processing on the inverse matrix of the upper triangular matrix to generate a lower triangular matrix; wherein the lower triangular matrix is stored in the form of whole column storage;
[0047] The storage conversion module is used to convert the storage mode of the inverse matrix of the upper triangular matrix into a sequential storage form;
[0048] The matrix multiplication module is used to perform matrix multiplication processing on the inverse matrix of the upper triangular matrix and the lower triangular matrix to generate the inverse matrix of the target source matrix.
[0049] Compared with the prior art, the invention has the following beneficial effects: in the calculation of matrix inversion based on Cholesky decomposition, the invention deconstructs the original cumulative summation form in an iterative manner, replaces the complex multiplication and accumulation calculation with complex multiplication and complex addition, and saves calculation resources; at the same time, the invention supports multi-parallel calculation operations, greatly shortens the calculation time, and improves the calculation efficiency; in addition, the invention changes the storage form of the calculated triangular matrix in SRAM to meet the storage form requirements of general matrix multiplication in SRAM, can reuse multiple matrix multiplication modules, improves the scalability of Cholesky matrix inversion, and when performing algorithm integration, due to the reusability of the invention, can save area overhead to a large extent; finally, the invention modifies the calculation process, processes the zero-filling step in parallel with the remaining steps, avoids additional zero-filling time, greatly shortens the calculation time of the matrix inversion, and improves the performance of the matrix inversion. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 A flowchart of a method for iteratively calculating a matrix inversion based on Cholesky decomposition provided in an embodiment of the present disclosure;
[0051] Figure 2 An overall architecture diagram of a matrix inversion hardware system provided by an embodiment of the present disclosure;
[0052] Figure 3 A matrix inversion calculation flow chart based on Cholesky decomposition provided in an embodiment of the present disclosure;
[0053] Figure 4 A schematic diagram of a Cholesky decomposition using multi-parallel iteration provided in an embodiment of the present disclosure;
[0054] Figure 5 A schematic diagram of a triangular matrix inversion method using multi-parallel iteration provided by an embodiment of the present disclosure;
[0055] Figure 6 A schematic diagram of sequential storage of matrix elements in SRAM provided by an embodiment of the present disclosure;
[0056] Figure 7 A schematic diagram of storing matrix elements in a SRAM in a column format provided by an embodiment of the present disclosure;
[0057] Figure 8 A schematic diagram of an iterative matrix inversion system based on Cholesky decomposition provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0058] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.
[0059] See also Figure 2 , Figure 2 The overall architecture diagram of a matrix inversion hardware system provided in an embodiment of the present disclosure; the system can be regarded as a DSP system for executing an iterative matrix inversion method based on Cholesky decomposition in the present disclosure.
[0060] Among them, cho_inv_fsm and tri_inv_fsm correspond to the control logic of Cholesky decomposition and triangular matrix inversion respectively. FSM (Finite State Machine) is the core part used to control the execution order of hardware. In Cholesky decomposition, FSM is responsible for coordinating each step of matrix decomposition; in triangular matrix inversion (Tri_inv), FSM is responsible for controlling the calculation steps of matrix inversion.
[0061] top_fsm is the main control module of the entire system, which is used to coordinate the data flow and task scheduling between different modules to ensure that the hardware system executes in sequence.
[0062] PE_MUX is used to select data flow between different processing units. The processing units may include multiplication (mul_send, mul_rec), addition / multiplication-addition (mul_add_send, mul_add_rec), division (div_send, div_rec), etc. MUX can be understood as a data selector, which selects the appropriate processing path according to the specific task.
[0063] The Cholesky decompose part is marked in the red box on the left, showing the computational units used for the Cholesky decomposition process, including:
[0064] div_send: responsible for sending the division operation data to the division calculation unit.
[0065] mul_send: responsible for sending the multiplication operation data to the multiplication calculation unit.
[0066] mul_add_send: responsible for sending the multiplication and addition operation data to the addition / multiplication and addition calculation unit.
[0067] data_gen: used to generate the data required in the Cholesky decomposition process. In the data generation stage, the present invention designs a segmented zero-filling operation, selects data by judging the conditions, and the elements before the diagonal elements are all zero, and the elements on and after the diagonal are the data stored in the SRAM. The zero-filling operation is completed when the data is taken out, avoiding the situation where the lower triangular area needs to be filled with zeros after the Cholesky decomposition calculation is completed.
[0068] The Tri_inv part is marked in the red box on the right, showing the computational units used to process the inversion of the triangular matrix, similar to the Cholesky decomposition part, including:
[0069] Modules such as div_rec, mul_rec, and mul_add_rec are used to receive and process the calculation results of division, multiplication, multiplication and addition, and generate the storage address of the calculation results.
[0070] Pre_padding is a module used to pre-process input data, which involves aligning or zero-padding the input matrix to meet the hardware's computing requirements (for example, aligning the matrix to a certain bit width). Since the SRAM interval used for zero-padding is different from the SRAM interval used for Cholesky decomposition, the SRAM used to store the triangular matrix inversion can be zero-padding at the same time when performing Cholesky decomposition calculations. The time for Cholesky decomposition calculations is greater than the time for zero-padding, so the zero-padding operation can be completed before the triangular matrix inversion stage, thereby avoiding the need to allocate additional time for zero-padding.
[0071] reorder is a rearrangement module responsible for reordering matrix data. Since data needs to be accessed by column or row during matrix decomposition and inversion, this module is used to ensure that the data storage order matches the calculation order.
[0072] SRAM_MUX is the system's storage control module, responsible for managing SRAM access and data transfer. All data in the system, including input matrices, intermediate results, and final inverse matrices, need to be stored in SRAM and scheduled through SRAM_MUX. SRAM_MUX can switch between multiple data streams, such as reading data from a reorder module or a transpose module, or sending data to a computation engine (PE_MUX).
[0073] transpose is responsible for transposing matrix data. In the process of matrix inversion, it is necessary to perform conjugate transposition on the inverse matrix of the upper triangular matrix to generate a lower triangular matrix. This module implements the data transposition function.
[0074] From the generation of input data (data_gen) to Cholesky decomposition, and then to triangular matrix inversion, the data will pass through various operation modules and finally complete the data storage and retrieval through SRAM_MUX. Cholesky decomposition and triangular matrix inversion are the two core steps in the matrix inversion process. Cholesky decomposition is used to decompose the matrix into upper triangular matrix and lower triangular matrix, while triangular matrix inversion is responsible for calculating the inverse of the upper triangular matrix.
[0075] Reorder is used to sort the data as necessary to meet the computing requirements of the hardware. Since the entire row elements of the source 1 matrix and the entire column elements of the source 2 matrix need to be multiplied and accumulated correspondingly during the calculation of matrix multiplication, if you want to improve the parallelism of the matrix multiplication calculation, you need to perform data access operations on multiple banks at the same time to calculate the multiplication and accumulation of multiple data each time, and the storage form of the data in the bank also needs to be specially specified. For the source 1 matrix, multiple elements of the same row need to be taken out each time, so the data is stored in the SRAM in the form of a whole column (column major order); for the source 2 matrix, multiple elements of the same column need to be taken out each time, so the elements are stored in the SRAM in the form of a whole row (row major order). The reorder module converts the storage form of the two calculated matrices from a single whole column storage to a whole column storage and a whole row storage, so that it meets the general matrix multiplication requirements for the storage form of the source data in the SRAM, and can reuse any matrix multiplication module, which improves the reuse rate and increases the scalability of the Cholesky matrix inversion system.
[0076] The hardware system completes the matrix inversion operation based on Cholesky decomposition through the collaborative work of multiple modules. The main calculations include Cholesky decomposition, triangular matrix inversion, and data storage management through SRAM. The MUX module is responsible for controlling the selection and switching of data flow, while the rearrangement and transposition modules ensure the correct order of data during the operation. The system architecture is designed mainly for efficient processing of large-scale matrix operations and is suitable for implementation in a hardware acceleration environment.
[0077] See also Figure 1 , is a flowchart of an iterative calculation matrix inversion method based on Cholesky decomposition provided by an embodiment of the present disclosure, the method comprising steps S101 to S106, wherein:
[0078] S101: Acquire a target source matrix; wherein the target source matrix comprises: an N-order conjugate positive definite matrix;
[0079] S102: Based on Cholesky decomposition, perform a first iterative process on the target source matrix to generate an upper triangular matrix;
[0080] S103: performing a second iterative process on the upper triangular matrix to generate an inverse matrix of the upper triangular matrix;
[0081] S104: performing conjugate transposition processing on the inverse matrix of the upper triangular matrix to generate a lower triangular matrix; wherein the lower triangular matrix is stored in the form of whole column storage;
[0082] S105: converting the storage mode of the inverse matrix of the upper triangular matrix into a sequential storage form to reuse the matrix multiplication module in the DSP system;
[0083] S106: Perform matrix multiplication processing on the inverse matrix of the upper triangular matrix and the lower triangular matrix to generate the inverse matrix of the target source matrix.
[0084] Among them, Cholesky decomposition is a matrix decomposition technique that decomposes a symmetric positive definite matrix into a lower triangular matrix and its conjugate transpose, which is used to simplify matrix operations and is particularly suitable for solving linear equations, matrix inverse operations, etc. Through this decomposition, the computational complexity can be reduced and the numerical stability can be optimized.
[0085] For example, see Figure 3 , Figure 3 A matrix inversion calculation flow chart based on Cholesky decomposition provided in an embodiment of the present disclosure is provided. The calculation flow chart can be executed based on the above steps S101 to S106, wherein:
[0086] It is divided into two main stages: the Cholesky decomposition stage and the triangular matrix inversion stage, which ultimately generates the inverse matrix of the matrix.
[0087] In the Cholesky decomposition stage, the target matrix is decomposed into an upper triangular matrix and a lower triangular matrix. The specific steps are as follows:
[0088] Step 1: Find the square root of the diagonal elements: First, take the square root of the diagonal elements of the matrix and calculate the square root of the diagonal elements. The diagonal elements are a very important part of the decomposition process and need to be ensured to be positive definite.
[0089] Step 2: Find the inverse square root: Next, calculate the inverse square root of these diagonal elements. This step provides the necessary intermediate values for subsequent off-diagonal element updates.
[0090] Step 3: Update row elements at Nth iteration: Then, in each iteration, for each row of the matrix, update the corresponding off-diagonal elements, using the previously calculated diagonal elements to update these off-diagonal elements.
[0091] Step 4: Update the elements in the lower right rectangular area: After the diagonal elements and the off-diagonal elements of the corresponding rows are updated, start updating the rectangular area in the lower right corner of the matrix, that is, the unprocessed part. This step gradually completes the decomposition process by gradually reducing the unprocessed area of the matrix.
[0092] Step 5: Zero padding of the triangular matrix: In order to ensure the accuracy of the decomposition results and optimize the efficiency of hardware operations, the unprocessed triangular matrix area needs to be padded with zeros to prevent unnecessary data interference.
[0093] The upper triangular matrix generated by Cholesky decomposition needs to be inverted next. The specific steps are as follows:
[0094] Step 6: Find the reciprocal of the diagonal elements: Perform the reciprocal operation on the diagonal elements of the upper triangular matrix to generate the diagonal elements of the inverse matrix.
[0095] Step 7: Update column elements at the Nth iteration: Similar to the operation of updating row elements during Cholesky decomposition, during the generation of the inverse matrix, the non-diagonal elements of each column are updated in turn.
[0096] Step 8: Update the elements in the upper right rectangular area: After the column elements are updated, the elements in the upper right rectangular area also need to be updated. This step ensures that the inverse matrix of the upper triangular matrix can be generated correctly in the end.
[0097] Step 9: Conjugate transpose of the triangular matrix: After generating the inverse matrix of the upper triangular matrix, perform a conjugate transpose operation on it to generate a lower triangular matrix.
[0098] In the final stage of matrix inversion, data storage and conversion operations are performed:
[0099] Step 10: Convert the entire column storage to sequential storage: Convert the inverse matrix storage format of the upper triangular matrix from the entire column storage to sequential storage to facilitate subsequent matrix multiplication operations.
[0100] Step 11: Matrix multiplication: In the last step, the inverse matrix of the upper triangular matrix is multiplied by the lower triangular matrix to generate the inverse matrix of the target matrix.
[0101] The whole process finally completes the matrix inversion operation by gradually decomposing and inverting. In hardware implementation, the efficiency of matrix operations can be significantly improved by parallelizing column and row priority processing.
[0102] Regarding S101 above:
[0103] In a specific implementation, it is necessary to obtain an N-order conjugate positive definite matrix as the input source matrix of the matrix inversion method of the present invention. The matrix can be provided by an external input module or generated internally by a computer system. The target source matrix has the following characteristics:
[0104] It is an N-order matrix, that is, the matrix has N rows and N columns;
[0105] The matrix is a conjugate positive definite matrix, which satisfies that all the eigenvalues of the matrix are positive and the matrix is a symmetric matrix.
[0106] Exemplarily, in a specific application scenario, the matrix may be a matrix generated by data processing in signal processing, scientific computing or other engineering fields.
[0107] In this way, by obtaining an N-order conjugate positive definite matrix as the source matrix, it is ensured that the input matrix has specific mathematical properties, that is, its eigenvalues are all positive and symmetric. This kind of matrix is widely used in scientific computing, signal processing and other applications. Using this matrix as input ensures the feasibility of subsequent Cholesky decomposition and lays the foundation for efficient inverse calculation.
[0108] Regarding S102 above:
[0109] In a specific implementation, after obtaining the target source matrix, a Cholesky decomposition operation is first performed on it. The Cholesky decomposition method adopted by the present invention decomposes the matrix through recursive processing, decomposing the original conjugate positive definite matrix A into a lower triangular matrix L and its conjugate transposed matrix L T ,Right now:
[0110] A=L·L T
[0111] Among them, L is a lower triangular matrix, L T In the specific implementation of the present invention, the upper triangular matrix U is actually calculated and stored.
[0112] To generate this upper triangular matrix, the decomposition process is performed iteratively, and each iteration includes the following steps:
[0113] Take the square root of the diagonal elements and find the reciprocal to obtain the diagonal elements of the upper triangular matrix;
[0114] performing complex multiplication operations on off-diagonal elements in rows following the diagonal elements, and updating these off-diagonal elements in the matrix;
[0115] Update the elements of the lower right rectangular area of the matrix through recursive processing.
[0116] After completing N iterations, the upper triangular matrix U is finally obtained.
[0117] In this way, the source matrix is decomposed into an upper triangular matrix through iterative processing based on Cholesky decomposition. Compared with the traditional method of directly solving the matrix inverse, Cholesky decomposition gradually reduces the complexity of calculation by iteratively updating the diagonal and off-diagonal elements of the matrix. Through this decomposition, the computational efficiency can be improved in hardware systems with limited computing resources, avoiding the computational overhead and complexity caused by direct inversion.
[0118] For example, Figure 4 A schematic diagram of Cholesky decomposition using multi-parallel iteration is shown. In this diagram, the element A of the matrix i,j The decomposition methods of diagonal elements and off-diagonal elements are clearly distinguished. The figure divides the different regions by dotted lines, and arrows are used to indicate the direction of parallel processing. Overall, the decomposition process adopts a column-first update method to process and update the matrix in parallel.
[0119] In this hardware system, matrix elements are updated in a column-first manner. According to the annotation on the left side of the figure, 16 columns are processed simultaneously in each iteration. This high degree of parallelism greatly improves the computing efficiency, especially in a hardware acceleration environment. Through parallel processing, the time overhead of a single operation can be significantly reduced. At the same time, the hardware system can use multiple computing units to perform the update task of each column in parallel, ensuring high efficiency in the data processing process.
[0120] As the iterations proceed, the number of updated columns gradually decreases. This can be seen from the annotation on the right side of the figure: when the number of iterations is a multiple of 16, the number of columns to be updated is reduced by 16 columns. In other words, after every 16 iterations, the size of the matrix to be processed will decrease, and the complexity of the decomposition will gradually decrease. This feature is consistent with the mathematical properties of Cholesky decomposition. As the diagonal elements are gradually decomposed and determined, the remaining unprocessed area gradually decreases, which significantly reduces the workload of subsequent iterations.
[0121] For the specific operation of each iteration, the red dotted line in the figure indicates the area to be updated in the current iteration, and the black dotted line indicates the area that has been updated. 1,1 ,A 16,16 ,A 32,32 etc. are the core elements of Cholesky decomposition. Each iteration first processes these diagonal elements, ensures that they are positive and completes the corresponding square root operation. After the diagonal elements are processed, the elements in the off-diagonal area are gradually updated. For example, like A 1,16 and A 17,16Such non-diagonal elements are updated iteratively after the diagonal elements are processed.
[0122] The multi-parallelism strategy adopted by the system can ensure that in each round of iteration, not only a single matrix column is processed, but multiple columns are processed simultaneously, thereby accelerating the entire Cholesky decomposition process. The efficiency of parallel processing is mainly reflected in: by processing 16 columns of matrix elements simultaneously, the system can maximize the use of hardware parallel computing resources. In hardware design, such a parallel strategy can effectively improve the speed of matrix solving and reduce processing time, which is particularly suitable for large-scale matrix solving scenarios.
[0123] In summary, Figure 4 The schematic diagram in the figure shows the multi-parallel iterative Cholesky decomposition process in detail. The matrix is gradually decomposed by column-first parallel updating, and in each round of iteration, as the diagonal elements are determined, the area to be processed is gradually reduced until the decomposition and solution of the entire matrix are completed. This scheme not only improves the efficiency of calculation, but also makes full use of the hardware acceleration capability, making large-scale matrix inversion possible.
[0124] As an optional implementation, the generation of an upper triangular matrix includes: performing a square root operation on the diagonal elements of the target source matrix and calculating the reciprocal thereof to determine the diagonal elements of the upper triangular matrix; performing complex multiplication operations on the non-diagonal elements located after the diagonal elements in the Nth row of the target source matrix to update the non-diagonal elements of the upper triangular matrix; based on the upper triangular matrix elements, performing calculation updates on each element of the lower right rectangular area of the target source matrix; in response to completing N calculation updates, ending the first iterative processing to generate the upper triangular matrix.
[0125] For each element a in row N kj , the present invention designs a zero-filling mechanism, when k>j, a kj =0; when k≤j, a kj =a kj , then perform the operation This segmented zero-filling mechanism avoids the need for an additional separate zero-filling stage and reduces the Cholesky decomposition time.
[0126] Exemplarily, the Cholesky decomposition is expressed as follows:
[0127]
[0128] where u kk are the diagonal elements of the upper triangular matrix, a kk are the diagonal elements of the source matrix, and k is the current iteration number.
[0129]
[0130] in is the multiplier for the elements following the diagonal elements in the kth row.
[0131]
[0132] where u kj is the element following the diagonal element of the kth row of the upper triangular matrix.
[0133]
[0134] in is the result of iteration of the elements in the lower right rectangular area, a ij is the value of the lower right rectangular area before iteration, is the complex conjugate of the k-th row element of the upper triangular matrix.
[0135] Through the above steps, the system iteratively processes the diagonal elements and off-diagonal elements of the target source matrix one by one until N iterations are completed to generate a complete upper triangular matrix U.
[0136] The upper triangular matrix is gradually generated through multiple iterations. This iterative processing method ensures that each step is based on the processed matrix elements, reduces error propagation, and improves the accuracy of the calculation results.
[0137] Regarding S103 above:
[0138] In a specific implementation, after generating the upper triangular matrix U, the inverse matrix generation operation of the upper triangular matrix is performed. This process is also completed through iteration, and the specific steps are as follows:
[0139] First, find the inverse of the diagonal elements of the upper triangular matrix to determine the diagonal elements of the inverse matrix;
[0140] Perform complex multiplication operations on the off-diagonal elements of the upper triangular matrix and update the corresponding off-diagonal elements of the inverse matrix;
[0141] Finally, update the elements of the upper right rectangular area to ensure that all elements of the inverse matrix are calculated accurately.
[0142] After N iterations, we finally get the inverse matrix U of the upper triangular matrix U. -1 .
[0143] In a specific implementation, it is first necessary to process the diagonal elements of the upper triangular matrix, specifically to perform a reciprocal operation thereon, so as to determine the diagonal elements of the inverse matrix.
[0144] For example,
[0145] The inversion of the described triangular matrix is expressed as follows:
[0146] s kk =1 / u kk
[0147] where s kk is the diagonal element of the inverse matrix, u kk are the diagonal elements of the upper triangular matrix, and k is the current iteration number.
[0148]
[0149] in is the result of the inverse matrix above the diagonal elements in the kth column after iteration, s ik The value before the iteration.
[0150]
[0151] in is the result of the elements in the upper right rectangular area after iteration, s ij The value before the iteration.
[0152] Through the above steps, after N iterations, the inverse matrix U of the upper triangular matrix is finally generated. -1 . This inverse matrix will be used in subsequent conjugate transpose operations and matrix multiplication operations.
[0153] In this way, this step generates the inverse matrix of the upper triangular matrix by gradually iterating the matrix. Compared with directly performing the inverse operation on the entire matrix, gradually iterating and updating the diagonal and off-diagonal elements can reduce the numerical errors in the calculation process, which is especially suitable for the inverse calculation of large-scale matrices. Through this step, the accuracy of the calculation is ensured and the overall process of matrix inversion is optimized.
[0154] For example, Figure 5 A schematic diagram of a triangular matrix inversion using multi-parallel iteration provided in an embodiment of the present disclosure.
[0155] In the figure, U ij Represents the elements of the upper triangular matrix, distributed in different rows and columns. The diagonal elements of the matrix are the key part, such as U 11 ,U kk ,U k+16k+16 Etc., these diagonal elements will be processed first in the process of inverting the triangular matrix.
[0156] The design of the entire diagram shows how to update the matrix step by step through parallel processing. The arrow indicates the direction of parallel processing (PARALLEL), that is, the matrix is updated from the upper left corner to the lower right corner, and the rows and columns are updated simultaneously.
[0157] exist Figure 5 In the figure, the update process of the matrix adopts a parallel strategy, updating 16 columns at a time, one by one. The right side of the figure is marked with "update 16 columns of data each time, and update downward in sequence", which shows that the system can process multiple columns of data at the same time in each round of iteration, thereby improving the efficiency of the inversion process.
[0158] The red and blue dashed boxes indicate the update areas at different stages:
[0159] Black dotted box: represents the 16 columns of data processed in the current iteration. As the iteration proceeds, this part of the data will be gradually updated. Red dotted box: represents the matrix area that has been processed or is being processed in the current processing stage. This part is part of the area to be updated. Blue dotted box: represents the matrix area that will be updated in the next iteration. Through this segmented processing strategy, the system can calculate in parallel and gradually reduce the problem size after each round of update, that is, as the number of iterations increases, the upper right rectangular area that needs to be updated gradually shrinks.
[0160] When solving the inverse matrix of an upper triangular matrix, it is mainly divided into the following steps:
[0161] Inverse the diagonal elements: For example, 11 ,U kk ,U k+16k+16 These elements are first reciprocated to obtain their inverse elements. The diagonal elements are the basis of the solution process and can be used to update other non-diagonal elements after processing.
[0162] Update of non-diagonal elements: In the process of updating 16 columns each time, in addition to the diagonal elements, other non-diagonal elements need to be updated through step-by-step iteration and multiplication. The update of these non-diagonal elements depends on the calculation results of the diagonal elements in the previous iteration. Through parallel processing, the system can process 16 columns of data at the same time. This strategy greatly speeds up the inversion process of the triangular matrix.
[0163] as Figure 5 As shown in the lower right corner, with each iteration, the unprocessed matrix area gradually shrinks. The update process starts from the upper left corner of the matrix and gradually advances to the lower right corner along the diagonal, updating 16 columns each time. As the number of iterations increases, the amount of data to be processed decreases, and the solution speed is gradually accelerated.
[0164] By gradually reducing the update range, the system can ensure the accuracy and efficiency of matrix inversion while maintaining high parallelism.
[0165] Regarding S104 above:
[0166] After the generation of the inverse matrix of the upper triangular matrix is completed, a conjugate transpose operation is performed on it to obtain a lower triangular matrix. Specifically, the following steps are followed: each element in the inverse matrix of the upper triangular matrix is taken out one by one in row order; a conjugate complex operation is performed on each element taken out; and the conjugate complex elements are placed in the storage area of the lower triangular matrix in column order. When storing, the elements of the first row are sequentially used as the first column of the lower triangular matrix, the elements of the second row are sequentially used as the second column of the lower triangular matrix, and so on. Finally, the conjugate transpose processing of the entire inverse matrix of the upper triangular matrix is completed to generate a lower triangular matrix.
[0167] In a specific implementation, each element in the inverse matrix of the upper triangular matrix is first taken out one by one according to a first preset order. The first preset order is to take out the matrix elements row by row in row order:
[0168] First, take out all elements from the first row of the inverse matrix of the upper triangular matrix in sequence; then take out the elements of the second row, and so on, until all the elements of all rows are taken out. This operation ensures that all matrix elements are taken out in order, which is convenient for subsequent conjugate complex number calculations.
[0169] Each extracted upper triangular matrix inverse matrix element is subjected to conjugate complex operation, and the specific operation is as follows: if an element is a+bi, its conjugate complex number is a-bi; each extracted element is subjected to this operation in turn to generate the conjugate complex number element.
[0170] After the conjugate complex number calculation, the elements are stored in the storage area of the lower triangular matrix in a second preset order. The second preset order is to store in column order: the elements generated in the first row are stored in the first column of the lower triangular matrix, the elements in the second row are stored in the second column, and so on, until all elements are stored.
[0171] Through the above operations, all the elements of the upper triangular matrix inverse matrix have been taken out one by one, the conjugate complex numbers have been calculated, and they have been stored in the lower triangular matrix in order. At this point, a complete lower triangular matrix has been generated and is ready for subsequent matrix operations.
[0172] In this way, the lower triangular matrix is generated by performing a conjugate transposition operation on the inverse matrix of the upper triangular matrix. When processing complex matrices, directly performing conjugate operations on matrix elements can effectively avoid error accumulation. The conjugate transposition process converts the upper triangular matrix into a lower triangular matrix, which is conducive to the optimization of subsequent matrix multiplication.
[0173] Regarding the above S105:
[0174] The inverse matrix of the upper triangular matrix is initially stored in the storage area of the hardware in the form of "whole column storage". In order to improve the efficiency of subsequent matrix multiplication operations, the present invention converts the storage mode of the matrix into a "sequential storage" form. The specific steps are as follows: read each element row by row from the matrix stored in the whole column; store the elements in each row in row order, ensuring that the matrix is arranged in a "row by row" form in the storage. In this way, by converting the inverse matrix of the upper triangular matrix from the whole column storage form to the sequential storage form, the present invention significantly optimizes the computational efficiency of the subsequent matrix multiplication. In the hardware environment, the whole column storage is suitable for parallel processing, but the efficiency is low when accessed row by row. The sequential storage method makes it more convenient to access the matrix elements, especially when performing matrix multiplication, it can reduce the random access operation of the memory and improve the overall performance of the hardware. In addition, one of the purposes of changing the data storage form to sequential storage is to adapt the matrix multiplication module, and any matrix multiplication module can be reused, which improves the reuse rate and increases the scalability of the Cholesky matrix inversion system. As an optional embodiment, the first preset order includes: taking out row by row; the second preset order includes: putting in column by column;
[0175] The row-by-row extraction includes: extracting each element from the first row of the inverse matrix of the upper triangular matrix from left to right in sequence; then, extracting elements from the second row from left to right in sequence; and continuing to process in the same order until elements of all rows have been extracted.
[0176] The column-by-column placing includes: storing the elements after conjugate complex number calculation in the storage area of the lower triangular matrix in column order; storing the elements taken out from the first row in the first column of the lower triangular matrix; storing the elements taken out from the second row in the second column of the lower triangular matrix; and continuing to process in the same order until all elements have been stored in the corresponding columns.
[0177] In the specific implementation, first, starting from the first row of the upper triangular inverse matrix, each element is taken out from left to right in turn; then, each element in the second row is taken out from left to right in turn; the above steps are repeated until the elements of all rows have been taken out row by row, until the elements of the last row are taken out. Through this operation, all elements of the upper triangular inverse matrix are extracted in order of row priority, which is convenient for subsequent conjugate complex number calculation and storage operations.
[0178] Regarding S106 above:
[0179] In the specific implementation, after completing the storage mode conversion, the upper triangular matrix U -1 The lower triangular matrix (U -1 ) T Perform matrix multiplication. According to the matrix multiplication formula:
[0180] A -1 =U -1 ·(U -1 ) T
[0181] Through this operation, the inverse matrix of the target source matrix A is finally generated.
[0182] Thus, by transforming the upper triangular matrix U -1 and the lower triangular matrix (U -1 ) T The multiplication operation is performed to generate the inverse matrix of the target matrix. Matrix multiplication is a key step in matrix inversion. Through the previous transformation of decomposition and storage methods, the matrix multiplication module can be reused to improve the reuse rate. In the hardware acceleration environment, this step-by-step processing and optimized storage method significantly reduces the time complexity and resource usage of matrix operations. The inverse matrix finally generated can meet the real-time requirements of large-scale computing applications while ensuring accuracy.
[0183] As an optional implementation, the area for storing matrix elements is SRAM, which consists of 64 banks. Each bank is composed of 4 SRAM IPs with a width of 64 bits and a depth of 1024 bits, and can perform depth splicing and width splicing. The entire SRAM is divided into source data area 1, source data area 2, result area and intermediate result area, and each partition consists of 16 banks.
[0184] Among them, SRAM (static random access memory) is used to store matrix elements. In order to meet the storage requirements of large-scale matrix calculations, the design of SRAM adopts multi-bank parallel storage, and optimizes data access efficiency through reasonable storage partitioning and splicing strategies. The following will describe the composition and partitioning of SRAM in detail.
[0185] Exemplarily, the SRAM in the present invention is composed of 64 banks, each of which is formed by bit width splicing and depth splicing. Specifically, each bank is spliced by 4 SRAM IPs with a bit width of 64 bits and a depth of 1024 bits; bit width splicing: 4 SRAM IPs with a bit width of 64 bits are spliced to achieve a total bit width of 256 bits, which can increase the amount of data read or written at one time; depth splicing: SRAM IPs with a depth of 1024 bits are spliced in depth to meet the storage capacity required for large-scale matrix operations. This splicing method not only increases the total storage capacity of the SRAM, but also improves the bandwidth of data access, which is suitable for parallel processing of large-scale matrix data.
[0186] The entire SRAM storage space is divided into four functional areas, each of which consists of 16 banks. The specific partitions are as follows: Source data area 1: used to store the input target source matrix 1, supporting high-speed access to matrix data; Source data area 2: used to store the input target source matrix 2, ensuring independent storage from matrix 1 to facilitate matrix parallel calculation; Result area: used to store the final inverse matrix result generated by the calculation; Intermediate result area: used to store intermediate data in the iterative calculation process for use in subsequent calculations. This partition design ensures that the data in the matrix calculation process will not interfere with each other, and by storing the source data and intermediate results separately, it can significantly improve the data transmission efficiency during parallel processing.
[0187] The 64 banks of SRAM are spliced together by combining bit width and depth to form a larger capacity storage unit. Bit width splicing can expand the parallel access capability of storage, while depth splicing provides storage depth for large-scale data. The specific steps include: every 4 SRAM IP units are spliced by bit width to form a bit width of 256 bits; through this splicing, it supports one-time large data volume reading and writing operations, and optimizes the efficiency of large-scale data processing during matrix inversion.
[0188] In the specific implementation, the bank of each functional area realizes parallel reading and writing of source data, results and intermediate data through independent access control. Through high-bit-width data transmission, the system can quickly access and process large-scale matrix data during matrix inversion operations, significantly shortening data access latency and improving overall computing efficiency.
[0189] In this way, by adopting the multi-bank parallel structure of SRAM and a reasonable partitioning strategy, the present invention realizes efficient storage and fast access of large-scale matrix data. Bit width splicing improves the parallelism of data transmission, depth splicing increases storage capacity, and the division of functional areas avoids mutual interference of data, ensuring the independent storage of source data, calculation results and intermediate results. This design is particularly suitable for large-scale matrix inversion operations in a hardware acceleration environment, and can significantly improve the overall computing performance and data processing efficiency of the system.
[0190] As an optional implementation, the storage mode of the inverse matrix of the upper triangular matrix is converted into a sequential storage mode, including: the storage mode of the inverse matrix of the upper triangular matrix is whole column storage, that is, each column element of the matrix is stored in the same bank, the 1st and 2nd column elements are placed in bank1, the 3rd and 4th column elements are placed in bank2, and so on, the 15th and 16th column elements are placed in bank8, and then the 17th and 18th column elements are stored in bank1 again, forming a loop. Step 4 needs to change the whole column storage mode to a sequential storage mode, that is, start taking numbers row by row and fill them into 8 banks in sequence, the 1st and 2nd elements of the first row of the matrix are stored in bank1, the 3rd and 4th elements are stored in bank2, and so on, until the 15th and 16th elements are stored in bank8, and then the 17th and 18th elements are stored in bank1 again, forming a loop. Step 4 needs to take out and put in the matrix elements one by one.
[0191] In the specific implementation, in order to optimize the data access efficiency in matrix multiplication operations, the present application converts the element storage form from column storage to sequential storage. The sequential storage method stores matrix elements row by row to ensure better continuity and consistency of data when accessing.
[0192] For example, in the full column storage format, the inverse matrix of the upper triangular matrix is stored in column order, that is, the elements of each column of the matrix are stored in the same bank. The specific storage method is as follows:
[0193] The elements of columns 1 and 2 are stored in bank1;
[0194] The elements in columns 3 and 4 are stored in bank2;
[0195] And so on, the elements in the 15th and 16th columns are stored in bank8;
[0196] Subsequently, the elements of the 17th and 18th columns are stored in bank1 again to form a circular storage.
[0197] This storage method allows two columns of matrix elements to be stored consecutively in each bank, which helps to read matrix data in entire columns.
[0198] In order to improve the access efficiency of data in matrix multiplication operations, the present application converts the inverse matrix storage form of the upper triangular matrix from whole column storage to sequential storage. The specific conversion steps are as follows: take out the inverse matrix elements of the upper triangular matrix one by one in row order; for example, starting from the first row, take out each element in the first row. The taken elements are stored in the bank in sequence according to the following rules: the 1st and 2nd elements of the first row are stored in bank1; the 3rd and 4th elements are stored in bank2; the 15th and 16th elements are stored in bank8 in sequence; the 17th and 18th elements are stored in bank1 again, forming a circular storage. Repeat the above operation for the elements of subsequent rows until all elements are stored in the bank in sequence.
[0199] This sequential storage format ensures that the elements of each row of the matrix are distributed and stored in multiple banks, which is conducive to subsequent parallel reading and processing.
[0200] During the conversion process, the elements of each row are sequentially stored in the storage units from bank 1 to bank 8. When the storage of the 8 banks is completed, the next set of data is stored again from bank 1. This ensures the sequential consistency of the data during storage and facilitates subsequent efficient access and processing.
[0201] Through this circular storage method, the system can effectively utilize storage bandwidth in subsequent operations and improve the parallelism of data transmission.
[0202] It should be noted that the inverse matrix generated at the beginning is not stored sequentially but stored as a whole column, which is to optimize the storage and access efficiency of specific calculation steps in matrix operations. For example, in matrix decomposition, especially in operations such as Cholesky decomposition, column-by-column updates or column-first operations are performed. The whole-column storage method allows column data to be quickly accessed and updated during matrix calculations: operations such as Cholesky decomposition and matrix inversion usually involve column-by-column processing. For example, when updating matrix elements, all elements of a column need to be accessed at once. Whole-column storage allows the elements of each column to be concentrated in the same bank, thereby optimizing the access efficiency of such operations. When matrix operations are processed column by column, column-first storage can avoid frequent cross-bank accesses, thereby reducing memory access latency and increasing calculation speed.
[0203] In hardware implementation, the whole-column storage method allows the data of each column to be accessed in parallel, making full use of the multi-bank structure and parallel computing resources in the hardware: column-first access ensures that during matrix operations, the data of each column can be read from the same bank at one time, reducing cross-bank data access operations.
[0204] When multiple banks access data in parallel, bandwidth utilization can be effectively improved. For example, a bank storing two columns of data can process multiple data blocks at the same time through a higher bit width (such as 256 bits), thereby improving parallel computing efficiency.
[0205] In the process of generating the inverse matrix of the upper triangular matrix, the matrix update and solution are usually performed in column priority order: because the generation of the inverse matrix involves gradually updating the elements of each column, the column storage method is conducive to the fast update and storage of these elements during the calculation process. When the matrix is inverted, updating column by column can reduce the waste of storage bandwidth and hardware resources, so that each column operation only accesses the data in one bank.
[0206] If sequential storage, i.e. row-by-row storage, is used initially, it may result in the need to access different columns of data in a row across multiple banks for each operation when decomposing the matrix or generating the inverse matrix. This will bring the following problems: Low efficiency of cross-bank access: Due to the characteristics of hardware parallel computing, when accessing multiple banks each time, if only a small portion of data is stored in each bank, banks will be frequently switched during calculation, resulting in reduced memory access efficiency. Poor data locality: Row-by-row storage will destroy data locality in column-first calculations, resulting in a loss of computing performance, especially when processing large-scale matrices. This storage method may cause frequent cache failures and data exchanges.
[0207] In subsequent operations, especially when matrix multiplication is required, it is more efficient to access data row by row. Therefore, after the initial matrix inversion process, the entire column storage form is converted to sequential storage form to accommodate subsequent matrix multiplication and other row-first calculation operations. Sequential storage distributes the data of each row into multiple banks, which can significantly improve data access efficiency and calculation speed when processing matrices row by row.
[0208] For example, see Figure 7 , Figure 7 A schematic diagram of storing matrix elements in SRAM in the form of columns provided by an embodiment of the present disclosure. In this storage mode, elements of each column of the matrix are stored in different banks in sequence. This design can optimize operations with matrix column priority, such as matrix decomposition or column priority calculation, and is suitable for hardware parallel processing.
[0209] Figure 7The SRAM in the MCU is divided into 8 banks (BANK0 to BANK7), and each bank stores multiple columns of matrix elements. In the whole column storage mode, each column of the matrix is stored in the same bank in order. For example: BANK0 stores the 1st and 2nd columns, the 17th and 18th columns, and so on. BANK1 stores the 3rd and 4th columns, the 19th and 20th columns, and so on.
[0210] In each bank, multiple columns of matrix elements are stored continuously until all columns of elements are stored. BANK0, BANK1, etc. store multiple columns of elements in sequence until all columns (e.g., columns 16k+1 to 16k+16) are completely stored.
[0211] Each bank stores elements of multiple columns in the form of whole columns. For example, in BANK0, the elements of columns 1 and 2 are stored in corresponding banks. Adjacent columns (such as columns 17 and 18) are also stored in the same bank to facilitate column-first operations. This arrangement allocates all columns of the matrix to different banks, forming a loop structure. For example, after columns 1 to 16 are stored, columns 17 to 32 will be stored in the same order.
[0212] This storage method is very efficient for column-first calculations. In Cholesky decomposition, inversion, or other column-first calculations of a matrix, the processor needs to access all elements of a column at once. By storing the data of the entire column in the same bank, it can be ensured that all the required column data is located in the same storage block each time it is accessed, thereby reducing the latency of cross-bank access and improving access speed.
[0213] from Figure 7 As can be seen from the storage diagram, each group of 16 columns of data is stored in 8 banks, forming a cycle. For example, the data of the 1st and 2nd columns are stored in BANK0; the data of the 17th and 18th columns are also stored in BANK0.
[0214] This column-circular storage ensures that data can still be stored efficiently when the matrix size increases, and in column-first operations, the system can process data from multiple different columns in the same way.
[0215] For example, see Figure 6 , Figure 6A schematic diagram of sequential storage of matrix elements in SRAM. As can be seen from the figure, each column of SRAM storage cells is divided into different banks, and each bank stores different elements of the matrix. The arrows of different colors in the figure indicate the order of data storage and reading, showing how the elements of the matrix are stored in each bank in row-first order.
[0216] exist Figure 6 In the , the storage structure of SRAM is divided into multiple banks (BANK0 to BANK7), each bank stores a part of the matrix elements. These matrix elements are stored in different banks in the order of row priority: BANK0 stores the first and second elements of the first row A 11 ,A 12 , the first and second elements A in the second row 21 ,A 22 , and the first and second elements A of the Nth row N1 ,A N2 BANK1 stores the 3rd and 4th elements A in row 1. 13 ,A 14 , the 3rd and 4th elements A in the 2nd row 23 ,A 24 , and the 3rd and 4th elements A in row N N3 ,A N4 By analogy, all matrix elements are stored in 8 different banks in this row-by-row order.
[0217] Figure 6 The sequential storage format is shown in Figure 1. The elements of the matrix are filled into each bank in a row-first manner. The specific operations of this sequential storage format are:
[0218] The first row element A 11 ,A 12 ,A 13 ,A 14 ,...store them in BANK0 to BANK7 in sequence until all elements in the row are stored.
[0219] Then store the second row element A 21 ,A 22 ,A 23 ,A 24 ,..., and then store them in BANK0 to BANK7 in the same order, and continue in the same storage order until all the elements of the matrix rows are stored.
[0220] This storage method ensures that data can be quickly accessed and read in a row-first manner when performing matrix calculations, and is particularly suitable for row-first operations such as matrix multiplication.
[0221] The blue and red arrows in the figure indicate the order in which the matrix elements are stored and read. The blue arrows indicate that the elements of each row are stored in sequence from BANK0 to BANK7, and the red arrows indicate that each row of the matrix is read in the same order. The order of storage and reading is consistent, ensuring smoothness and efficiency in data processing.
[0222] pass Figure 6 It can be seen that sequential storage means putting data into bank0-7 row by row, putting every 2 data into 1 bank, and putting the elements of a row into the next bank immediately after they are put in. Figure 6 After the first row of elements represented by the blue line is placed, the next bank is bank2, and the second row of elements represented by the red line is placed starting from bank2.
[0223] Based on the same inventive concept, an iterative matrix inversion system based on Cholesky decomposition corresponding to an iterative matrix inversion method based on Cholesky decomposition is also provided in an embodiment of the present disclosure. Since the principle of solving the problem by the system in the embodiment of the present disclosure is similar to the above-mentioned iterative matrix inversion method based on Cholesky decomposition, the implementation of the system can refer to the implementation of the method, and the repeated parts will not be repeated.
[0224] Reference Figure 8 As shown, an iterative calculation matrix inversion system based on Cholesky decomposition is provided in an embodiment of the present disclosure, and the system includes:
[0225] Matrix receiving module 10, matrix decomposition module 20, triangular matrix inversion module 30, matrix transposition module 40, storage conversion module 50 and matrix multiplication module 60; wherein,
[0226] The matrix receiving module 10 is used to obtain a target source matrix; wherein the target source matrix includes: an N-order conjugate positive definite matrix;
[0227] The matrix decomposition module 20 is used to perform a first iterative process on the target source matrix based on Cholesky decomposition to generate an upper triangular matrix;
[0228] The triangular matrix inversion module 30 is used to perform a second iterative process on the upper triangular matrix to generate an inverse matrix of the upper triangular matrix;
[0229] The matrix transposition module 40 is used to perform conjugate transposition processing on the inverse matrix of the upper triangular matrix to generate a lower triangular matrix; wherein the lower triangular matrix is stored in the form of whole column storage;
[0230] The storage conversion module 50 is used to convert the storage mode of the inverse matrix of the upper triangular matrix into a sequential storage form;
[0231] The matrix multiplication module 60 is used to perform matrix multiplication processing on the inverse matrix of the upper triangular matrix and the lower triangular matrix to generate the inverse matrix of the target source matrix.
[0232] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present disclosure.
[0233] It should be understood that determining B based on A does not mean determining B only based on A. B can also be determined based on A and / or other information.
[0234] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the present invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0235] The preferred embodiments of the present invention disclosed above are only used to help explain the present application. The preferred embodiments do not describe all the details in detail, nor do they limit the present application to specific implementation methods. Obviously, many modifications and changes can be made according to the content of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present application, so that those skilled in the art can understand and use the present application well. The present application is limited only by the claims and their full scope and equivalents.
Claims
1. An iterative matrix inversion method based on Cholesky decomposition, used in DSP system, characterized in that: include: Obtain a target source matrix; wherein the target source matrix includes: an N-order conjugate positive definite matrix; Based on Cholesky decomposition, performing a first iterative process on the target source matrix to generate an upper triangular matrix; Performing a second iterative process on the upper triangular matrix to generate an inverse matrix of the upper triangular matrix; Performing conjugate transposition processing on the inverse matrix of the upper triangular matrix to generate a lower triangular matrix; wherein the lower triangular matrix is stored in the form of whole column storage; Converting the storage mode of the inverse matrix of the upper triangular matrix into a sequential storage form to reuse the matrix multiplication module in the DSP system; Matrix multiplication is performed on the inverse matrix of the upper triangular matrix and the lower triangular matrix to generate the inverse matrix of the target source matrix.
2. The method according to claim 1, characterized in that Generating an upper triangular matrix comprises: Performing a square root operation on the diagonal elements of the target source matrix and calculating the reciprocal thereof to determine the diagonal elements of the upper triangular matrix; Performing a complex multiplication operation on the off-diagonal elements located after the diagonal elements in the Nth row of the target source matrix to update the off-diagonal elements of the upper triangular matrix; Based on the upper triangular matrix elements, each element of the lower right rectangular area of the target source matrix is calculated and updated; In response to completing N calculation updates, the first iterative process ends and the upper triangular matrix is generated.
3. The method according to claim 1, characterized in that The generating the inverse matrix of the upper triangular matrix comprises: Performing a reciprocal operation on the diagonal elements of the upper triangular matrix to determine the diagonal elements of the inverse matrix; Performing a complex multiplication operation on the non-diagonal elements above the diagonal elements in the Nth column of the upper triangular matrix to update the non-diagonal elements of the inverse matrix; Based on the updated off-diagonal elements of the inverse matrix, each element in the upper right rectangular area of the upper triangular matrix is calculated and updated; In response to completing N calculation updates, the second iterative process ends and an inverse matrix of the upper triangular matrix is generated.
4. The method according to claim 1, characterized in that: Generating a lower triangular matrix comprises: Based on a first preset order, taking out each element in the inverse matrix of the upper triangular matrix one by one; Perform conjugate complex number calculation on each of the extracted elements; Based on the second preset order, the elements after the conjugate complex number calculation are sequentially placed into the storage area of the lower triangular matrix.
5. The method according to claim 4, characterized in that The first preset order includes: taking out row by row; the second preset order includes: putting in column by column; The row-by-row extraction includes: extracting each element from the first row of the inverse matrix of the upper triangular matrix from left to right in sequence; then, extracting elements from the second row from left to right in sequence; and continuing to process in the same order until all elements of all rows have been extracted; The column-by-column placing includes: storing the elements after the conjugate complex number calculation in the storage area of the lower triangular matrix in order of columns; The elements taken from the first row are stored in the first column of the lower triangular matrix in sequence; The elements taken from the second row are stored in the second column of the lower triangular matrix in sequence; Continue processing in the same order until all elements have been stored in their corresponding columns.
6. The method according to claim 1, characterized in that Also includes: The area for storing matrix elements is SRAM, which consists of 64 banks, each bank is composed of 4 SRAM IPs with a width of 64 bits and a depth of 1024 bits. The splicing includes: depth splicing and width splicing. The SRAM is divided into a plurality of partitions, including: a source data 1 area, a source data 2 area, a result area, and an intermediate result area; wherein each of the partitions is composed of 16 banks.
7. The method according to claim 1, characterized in that The storage form of the inverse matrix of the upper triangular matrix is whole column storage; wherein, each column element of the inverse matrix of the upper triangular matrix is stored in the same bank, the 1st and 2nd column elements are placed in bank1, the 3rd and 4th column elements are placed in bank2, and so on, the 15th and 16th column elements are placed in bank8, and then the 17th and 18th column elements are stored in bank1 again, forming a cycle; The method of converting the storage mode of the inverse matrix of the upper triangular matrix into a sequential storage mode includes: for the inverse matrix of the upper triangular matrix stored in a whole column storage mode, starting to obtain data row by row, and filling them into 8 banks in sequence, the 1st and 2nd elements of the first row of the matrix are stored in bank1, the 3rd and 4th elements are stored in bank2, and so on, until the 15th and 16th elements are stored in bank8, and then the 17th and 18th elements are stored in bank1 again, forming a cycle.
8. The method according to claim 1, characterized in that The generating of the upper triangular matrix further comprises: For the row elements of the target source matrix, a piecewise zero-padding operation is performed; wherein, when the elements of the row are located below the corresponding column, the corresponding non-diagonal elements in the row are set to zero; When an element of a row is located on the diagonal or above the corresponding column, the off-diagonal elements of the row are calculated and updated to determine their values.
9. An iterative matrix inversion system based on Cholesky decomposition, characterized in that: The system comprises: a matrix receiving module, a matrix decomposition module, a triangular matrix inversion module, a matrix transposition module, a storage conversion module and a matrix multiplication module; wherein, The matrix receiving module is used to obtain a target source matrix; wherein the target source matrix includes: an N-order conjugate positive definite matrix; The matrix decomposition module is used to perform a first iterative process on the target source matrix based on Cholesky decomposition to generate an upper triangular matrix; The triangular matrix inversion module is used to perform a second iterative process on the upper triangular matrix to generate an inverse matrix of the upper triangular matrix; The matrix transposition module is used to perform conjugate transposition processing on the inverse matrix of the upper triangular matrix to generate a lower triangular matrix; wherein the lower triangular matrix is stored in the form of whole column storage; The storage conversion module is used to convert the storage mode of the inverse matrix of the upper triangular matrix into a sequential storage form; The matrix multiplication module is used to perform matrix multiplication processing on the inverse matrix of the upper triangular matrix and the lower triangular matrix to generate the inverse matrix of the target source matrix.
Citation Information
Patent Citations
Inverse operation method for lower triangle complex matrix with any order
CN103927290A
Cholesky matrix inversion system based on time division multiplexing technology
CN105701068A
Arbitrary-order matrix inversion hardware acceleration system based on cholesky decomposition, which adopts loop iteration mode
CN111723336A
Method, device and medium for triangular matrix inversion
CN116089786A
Cholesky decomposition-based matrix inversion apparatus
WO2021036313A1
Cited By
Optical calculation method, optical calculation system, storage medium, and program product
CN121072635A