Sparse matrix solving method, computer equipment, storage medium and program product

By generating and searching and eliminating trees, replacing deep search and converting them into upper and lower triangle matrices, the problems of instability and inefficiency of iterative methods in EDA simulation are solved, and the rapid solution of symmetric matrix and complex conjugation matrix is ​​realized. Improved computing efficiency.

CN119025811AActive Publication Date: 2024-11-26JULIN TECH (SHANGHAI) CO LTD

Patent Information

Application Number
CN202411495662.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-25
Publication Date
2024-11-26
Estimated Expiration
2044-10-25

AI Technical Summary

Technical Problem

In EDA's circuit and electromagnetic field simulation calculation, the iterative method used for matrix solution has problems of instability and slow convergence, especially when encountering pathological matrices, it is difficult to converge to a stable solution, and the calculation efficiency is low.

Method used

The sparse matrix solution method is used to generate, search and eliminate trees, replace deep search, and convert them into upper and lower triangle matrices, thereby achieving rapid solution of symmetric matrix and complex conjugate matrix, reducing time complexity.

Benefits of technology

The rapid solution of symmetric matrix and complex conjugate matrix is ​​realized, which reduces the computation time complexity, changes from O(n2) to O(n), and improves the calculation and simulation efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119025811A_ABST
    Figure CN119025811A_ABST
Patent Text Reader

Abstract

The invention provides a sparse matrix solving method, computer equipment, a storage medium and a program product. The method comprises the following steps: obtaining a row switching matrix and a column switching matrix corresponding to an original matrix through the original matrix; performing matrix transformation on the original matrix according to the row switching matrix and the column switching matrix to obtain a first transformation matrix; a check set is generated, the first transformation matrix is traversed, and non-zero element elements of the first transformation matrix are sequentially merged into the check set; generating an elimination tree according to the check set, and generating a lower triangular matrix according to the elimination tree; and obtaining an upper triangular matrix based on the lower triangular matrix, and performing matrix solving according to the upper triangular matrix and the lower triangular matrix. According to the scheme, the symmetric matrix and the complex conjugate matrix can be rapidly solved, and the time complexity of calculation can be reduced, so that the calculation and simulation efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of matrix solution, and in particular to a sparse matrix solution method, computer equipment, storage medium and program product. Background Art

[0002] In the process of EDA circuit and electromagnetic field simulation calculation, matrix solving is often indispensable. Generally, large-scale matrix solving is mostly solved by iterative method. The advantages of iterative method are simple implementation, low memory requirements, the calculation process mainly relies on spMv operator, and there are relatively mature operator acceleration solutions. However, the biggest disadvantage of iterative method is that the solution is very unstable and the iteration speed is slow, and various preprocessing is usually required to accelerate convergence. In addition, in the circuit and electromagnetic simulation in the field of EDA, a large number of ill-conditioned matrices will be encountered. The condition numbers of these matrices are very large, and it is difficult for iterative methods to converge to stable solutions. Therefore, there is an urgent need for a method that can speed up the calculation of sparse matrices. Summary of the invention

[0003] The purpose of the present invention is to provide a sparse matrix solution method, computer equipment, storage medium and program product, which can realize the rapid solution of symmetric matrices and complex conjugate matrices and reduce the time complexity of calculation.

[0004] The technical solution provided by the present invention is as follows: The present invention provides a sparse matrix solving method, comprising the steps of: Obtaining a row exchange matrix and a column exchange matrix corresponding to the original matrix through the original matrix; Performing a matrix transformation on the original matrix according to the row exchange matrix and the column exchange matrix to obtain a first transformation matrix; Generate a union-find set, and traverse the first transformation matrix, and merge the non-zero elements of the first transformation matrix into the union-find set in sequence; generating an elimination tree according to the union-find set, and generating a lower triangular matrix according to the elimination tree; An upper triangular matrix is ​​obtained based on the lower triangular matrix, and a matrix solution is performed according to the upper triangular matrix and the lower triangular matrix.

[0005] The above sparse matrix solution method uses the union-find search instead of the deep search of the original matrix, which originally takes O(n 2 ) is calculated in time complexity to O(n), which enables fast solution of symmetric matrices and complex conjugate matrices, thereby improving calculation and simulation efficiency.

[0006] In some implementations, performing a matrix transformation on the original matrix according to the row switching matrix and the column switching matrix to obtain a first transformation matrix specifically includes: The solution equation for the original matrix is Do the transformation to get Equation, wherein A is the original matrix, P is the row exchange matrix, and Q is the column exchange matrix; Get the first transformation matrix A 1 ,in, , then the solution equation of the original matrix is ​​converted to the solution equation.

[0007] In some implementations, obtaining a row switching matrix and a column switching matrix through an original matrix specifically includes: The original matrix is ​​graph-segmented by a nested partitioning algorithm so that the non-zero elements of the original matrix are gathered near the diagonal of the matrix, and then the original matrix is ​​permuted in rows and columns to obtain the row exchange matrix and the column exchange matrix.

[0008] In some implementations, generating an elimination tree according to the union-find set, and generating a lower triangular matrix according to the elimination tree, specifically includes: According to the column nodes, query the union-find set in sequence to generate the elimination tree; According to the elimination tree, threads are allocated to nodes of each layer of the elimination tree, so that each thread processes one node, and dependent nodes of each node are searched in the union-find set, and non-zero elements of the dependent nodes of each node are pushed into the stack of the node to obtain non-zero elements of each node; The lower triangular matrix L of the first transformation matrix is ​​obtained according to the non-zero elements of each node in each layer of the elimination tree.

[0009] In some implementations, nodes at different levels in the elimination tree are processed synchronously and in parallel, and nodes at the same level are processed asynchronously and in parallel.

[0010] In some implementations, obtaining an upper triangular matrix based on the lower triangular matrix specifically includes: According to the elimination tree, threads are assigned to each layer of nodes of the elimination tree, and an outer product calculation is first performed on each node and the dependent nodes corresponding to each node, and then an inner product calculation is performed to obtain the complete lower triangular matrix, and the lower triangular matrix is ​​permuted to obtain the upper triangular matrix U of the first transformation matrix.

[0011] In some implementations, performing matrix solving according to the upper triangular matrix and the lower triangular matrix is ​​specifically: pass and Perform matrix solve.

[0012] In a second aspect, the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the sparse matrix solution method of the first aspect.

[0013] In a third aspect, the present application provides a computer storage medium having stored thereon a computer program or instructions, which, when executed by a processor, implement the steps of the sparse matrix solution method of the first aspect.

[0014] In a fourth aspect, the present application provides a computer program product, comprising a computer program or instructions, which, when executed by a processor, implement the steps of the sparse matrix solution method of the first aspect.

[0015] According to a sparse matrix solution method, computer device, storage medium and program product provided by the present invention, a union-find search is used to replace the deep search of the original matrix, so that the calculation that originally requires O(n2) time complexity is changed to a calculation with O(n) time complexity, thereby realizing the rapid solution of symmetric matrices and complex conjugate matrices, thereby improving the calculation and simulation efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The preferred implementation scheme will be described below in a clear and understandable manner with reference to the accompanying drawings to further illustrate the above-mentioned characteristics, technical features, advantages and implementation methods of the present solution.

[0017] Figure 1 It is a schematic diagram of the overall process of an embodiment of the present invention; Figure 2 It is a flow chart of an embodiment of the present invention. DETAILED DESCRIPTION

[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the specific implementation methods of the present invention will be described below with reference to the accompanying drawings. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings and other implementation methods can be obtained based on these drawings without creative work.

[0019] In order to simplify the drawings, only the parts related to the present invention are schematically shown in each figure, and they do not represent the actual structure of the product. In addition, in order to simplify the drawings and facilitate understanding, in some figures, only one of the parts with the same structure or function is schematically drawn or marked. In this article, "one" not only means "only one", but also means "more than one".

[0020] In the process of EDA circuit and electromagnetic field simulation calculation, matrix solving is often indispensable. Generally, large-scale matrix solving is mostly solved by iterative method. The advantages of iterative method are simple implementation, low memory requirements, the calculation process mainly relies on spMv operator, and there are relatively mature operator acceleration solutions. However, the biggest disadvantage of iterative method is that the solution is very unstable and the iteration speed is slow, and various preprocessing is usually required to accelerate convergence. In addition, in the circuit and electromagnetic simulation in the field of EDA, a large number of ill-conditioned matrices will be encountered. The condition numbers of these matrices are very large, and it is difficult for iterative methods to converge to stable solutions. Therefore, there is an urgent need for a method that can speed up the calculation of sparse matrices.

[0021] Considering that in EDA simulation, the direct method is a very important matrix solving algorithm. Although the direct method matrix solving consumes a lot of memory, the direct method has a fast solving speed and stable solving results, which is a better choice in EDA simulation. More importantly, for situations that require repeated solutions, the original matrix is ​​converted into an upper and lower triangular matrix by Gaussian elimination and other methods, which can save frequent decomposition steps and quickly solve. Therefore, this application is improved on the basis of the direct method matrix solving.

[0022] The matrix solution of the direct method includes three core steps. The first step is to reduce the matrix fill-in values. The fill-in values ​​are the additional non-zero elements that appear in the process of Gaussian elimination. The number of additional non-zero elements is large, which not only consumes a lot of memory, but also significantly increases the calculation time. Therefore, the first step of the matrix solution is to reduce the number of non-zero fill-in values ​​of the matrix by exchanging rows and columns. The second step is static decomposition. The number of fill-in values ​​for the direct method matrix solution is very large. When new fill-in values ​​appear in the decomposition process, it is impossible to reallocate memory and reassign values. Therefore, it is necessary to estimate the number of fill-in values ​​in advance. The third step is dynamic decomposition. According to the data structure of the upper and lower triangular matrices, the matrix elements of the upper and lower triangular matrices are updated column by column to obtain the final upper and lower triangular matrices.

[0023] The purpose of static decomposition is, on the one hand, to determine the memory consumption of the L matrix and the U matrix before solving the problem. On the other hand, because in EDA simulation, matrices with the same structure need to be solved repeatedly, it is only necessary to calculate the static decomposition once to determine the distribution of non-zero elements of the matrix. The new result can be obtained by dynamic decomposition simply by reassigning the values.

[0024] The LU decomposition of a matrix generally uses a left-looking algorithm. From left to right, the L matrix and the U matrix are calculated column by column. For sparse matrices, the core of the algorithm is to distinguish which elements of the L and U matrices are non-zero elements. When calculating the jth column, as long as the kth column and the jth column have the same non-zero elements, all non-zero elements of the kth column will also become non-zero elements of the jth column. Conversely, when there are no overlapping elements in the kth column and the jth column, then j does not depend on k, and there is no need to calculate the impact of k on j. The non-zero element structure of the matrix is ​​equivalent to a directed acyclic graph. The nodes of the graph represent the columns, and the directed edges of the graph represent the dependencies. Based on this directed acyclic graph, the non-zero element information of the L and U matrices can be obtained to complete the static decomposition.

[0025] Each node of a directed acyclic graph may point to multiple nodes. Since the number of nodes pointed to is unknown, either static memory allocation is performed according to the total number of nodes, or dynamic memory allocation is used to continuously advance new structures. However, for matrices of tens of millions in EDA simulation, static memory allocation will waste a lot of memory, and dynamic memory allocation will completely fragment the memory. Both solutions are impossible to implement in engineering.

[0026] Therefore, static decomposition generally uses the method of traversing the matrix to find the fill-in values ​​in the upper and lower triangular matrices through matrix traversal and deep search. When traversing column j, if a non-zero element i is found, then traverse column i, find the non-zero element k in column i, then traverse k, and so on. In the process of traversing columns by this algorithm, the further you traverse, the longer the traversal process becomes, the greater the amount of calculation, and even the last few columns are completely filled with dense columns. For an ordinary matrix, it is impossible to judge the fill-in value of the current node based on the fill-in value of the previous node, because if the matrix is ​​not symmetric, (i, j) and (j, i) are not the same. When i>j, then the (i, j) element will not affect the fill-in value of the element in column i, but the (j, i) element value represents the fill-in value of column j that affects the fill-in value of column i, so it is necessary to deeply search the entire matrix to find all dependent nodes. However, the algorithm of using deep search to find dependent nodes results in many nodes that do not need to be searched or are repeated, wasting a lot of computing resources. The focus of this patent is to use an efficient data structure to generate a directed acyclic graph, greatly reduce search resources, and complete the static decomposition steps.

[0027] The dynamic decomposition in the third stage requires the outer product algorithm to be performed on the L matrix and the outer product algorithm to be performed on the U matrix respectively. When the matrix is ​​a real symmetric or complex conjugate matrix, the values ​​of the upper triangular matrix and the lower triangular matrix are completely transposed. Therefore, during dynamic decomposition, for each node, two outer product calculations and one inner product calculation are no longer required, and the symmetric matrix and the complex conjugate matrix can be quickly solved. Below, this solution will be described in detail with reference to the accompanying drawings: In one embodiment, the reference specification Figure 1 The present invention provides a sparse matrix solving method, comprising the steps of: S100, obtaining a row exchange matrix and a column exchange matrix corresponding to the original matrix through the original matrix; S200, performing matrix transformation on the original matrix according to the row exchange matrix and the column exchange matrix to obtain a first transformation matrix; S300, generating a union-find set, and traversing the first transformation matrix, and sequentially merging non-zero elements of the first transformation matrix into the union-find set; S400, generating an elimination tree according to the union-find set, and generating a lower triangular matrix according to the elimination tree; S500, obtaining an upper triangular matrix based on the lower triangular matrix, and performing matrix solution according to the upper triangular matrix and the lower triangular matrix.

[0028] Specifically, in the process of EDA circuit and electromagnetic field simulation, after obtaining the original matrix to be solved, the original matrix is ​​firstly exchanged between rows and columns to obtain a row exchange matrix and a column exchange matrix. A row exchange matrix (also called a permutation matrix or a transformation matrix) is a special type of square matrix used to represent the row exchange operation of a matrix. In a row exchange matrix, there is only one row in which all elements except 1 are 0, and this 1 indicates the position of the row exchange, while the other rows are the corresponding rows of the unit matrix; a column exchange matrix (also called a column permutation matrix) is a square matrix used to represent the column exchange operation of a matrix. Similar to a row exchange matrix, a column exchange matrix transforms a matrix by changing the order of its columns. In a column exchange matrix, there is only one column in which all elements except 0 are 1, and this 1 indicates the position of the column exchange, while the other columns are the corresponding columns of the unit matrix. In matrix calculations, especially in Gaussian elimination, row exchange matrices and column exchange matrices can be used to ensure the numerical stability of the algorithm, by placing the element with the largest absolute value (called the pivot or principal element) on the diagonal, which helps to reduce calculation errors.

[0029] In a specific implementation, performing matrix transformation on the original matrix according to the row exchange matrix and the column exchange matrix to obtain a first transformation matrix specifically includes: Solving equations for the original matrix Do the transformation to get Equation, where A is the original matrix, P is the row exchange matrix, and Q is the column exchange matrix; obtain the first transformation matrix A 1 ,in, , then the solution equation of the original matrix is ​​transformed into the solution equation.

[0030] This program introduces After the row-column permutation of the original matrix is ​​performed to obtain the row exchange matrix and the column exchange matrix, the solution equation of the original matrix can be transformed, so that the solution of the original matrix is ​​converted into the solution of the first transformation matrix with fewer fill-in values, thereby reducing the difficulty of calculation and improving the calculation efficiency.

[0031] Union-find is a data structure used to handle the merging and querying of some disjoint sets. Union-find supports two main operations: Find: Determine which subset an element belongs to. It can track the representative element (or root element) of the set; Union: Merge the sets to which two elements belong. Union-find is usually implemented using an array, and each element of the array stores the index of the root element of the set to which its index belongs. The following are the basic operations of union-find: MakeSet: Create a new set, and the element itself becomes its own parent node; Find: Find the root node of element x. If x's parent node is itself, then x is the root node of a set; Union: Merge the sets to which two elements belong, usually pointing the root node of one set to the root node of another set.

[0032] This application introduces a union-find. Since the time complexity of the union-find and query is O(n), the time complexity of matrix calculation can be significantly lower than the time complexity of deep search. Specifically, it can reduce the time complexity of the original O(n) 2 ) is calculated into O(n) time complexity.

[0033] After creating the union-find set, traverse the non-zero elements of the first transformation matrix A1 and merge them into the union-find set G one by one. This process is to add a set to each node so that after merging the non-zero elements into the union-find set, all information about the non-zero elements of the matrix can be saved in the union-find set data structure.

[0034] The elimination tree is a multi-layer structure, where the nodes in the upper layer depend on the nodes in the lower layer. With the node dependency of the elimination tree, during static decomposition or dynamic decomposition, the nodes in the same layer can use asynchronous parallelism, and the nodes in different layers can use synchronous parallelism. Since all information about the non-zero elements of the matrix is ​​stored in the union-find data structure, the elimination tree can be generated based on the union-find data structure, and then the lower triangular matrix corresponding to the first transformation matrix can be generated based on the elimination tree. The lower triangular matrix (LowerTriangular Matrix) is a special square matrix in which all elements above the main diagonal are zero.

[0035] After obtaining the lower triangular part of the original matrix, the upper triangular matrix corresponding to the first transformation matrix can be obtained based on the lower triangular matrix corresponding to the first transformation matrix, so as to solve the matrix according to the upper triangular matrix and the lower triangular matrix. The upper triangular matrix is ​​also a special square matrix, and all elements below the main diagonal are zero.

[0036] In a specific implementation, the matrix solution is performed according to the upper triangular matrix and the lower triangular matrix, specifically: After the first transformation matrix is ​​decomposed into an upper triangular matrix L and a lower triangular matrix U, and The matrix can be solved directly, and the result obtained is the solution of the original matrix.

[0037] The above sparse matrix solution method uses the union-find search instead of the deep search of the original matrix, which originally takes O(n 2 ) is calculated in time complexity to O(n), which enables fast solution of symmetric matrices and complex conjugate matrices, thereby improving calculation and simulation efficiency.

[0038] In one embodiment, based on the above embodiment, obtaining a row switching matrix and a column switching matrix through an original matrix specifically includes: The original matrix is ​​segmented by a nested-dissction algorithm so that the non-zero elements of the original matrix are gathered near the diagonal of the matrix as much as possible. Then the original matrix is ​​permuted in rows and columns to obtain the corresponding row-exchange matrix and column-exchange matrix.

[0039] In one embodiment, Figure 2 As shown, based on the above-mentioned embodiment, an elimination tree is generated according to a union-find set, and a lower triangular matrix is ​​generated according to the elimination tree, specifically including: S410, query and find the set in sequence according to the column nodes to generate an elimination tree; S420, according to the elimination tree, threads are assigned to nodes at each layer of the elimination tree, so that each thread processes one node, and dependent nodes of each node are searched in the union-check set, and non-zero elements of the dependent nodes of each node are pushed into the stack of the node to obtain non-zero elements of each node; S430 , obtaining the lower triangular matrix L of the first transformation matrix by eliminating the non-zero elements of each node in each layer of the tree.

[0040] Specifically, after querying the union-find set in sequence according to the column nodes to generate the elimination tree T, all the information of the non-zero elements of the first transformation matrix is ​​saved in the elimination tree. When allocating threads, nodes at different levels in the elimination tree are synchronously parallel, and nodes at the same level are asynchronously parallel. According to the elimination tree, threads are allocated according to each layer of nodes, and each thread processes one node. The node is searched in the union-find set. All nodes that belong to the same set as the current node are dependent nodes of this node. The non-zero elements of the dependent nodes are pushed into the stack of the current node, and the non-zero elements of the current node can be obtained. After all threads pass through the synchronous and asynchronous parallel elimination tree, the non-zero element structure of the lower triangular matrix L can be generated.

[0041] Preferably, obtaining an upper triangular matrix based on a lower triangular matrix specifically includes: According to the elimination tree, threads are assigned to each layer of the elimination tree, and an outer product calculation is first performed on each node and the dependent nodes corresponding to each node, and then an inner product calculation is performed to obtain a complete lower triangular matrix, and the lower triangular matrix is ​​permuted to obtain the upper triangular matrix U of the first transformation matrix.

[0042] Specifically, after obtaining the lower triangular matrix, similar steps to S410 to S430 are used to allocate different nodes of the thread according to the elimination tree. Each node needs to perform an outer product operation with its dependent node, and then perform an inner product operation. That is, the calculation of each node includes two steps: A) outer product of the L matrix; B) inner product of the L matrix. After obtaining the complete L matrix, the L matrix is ​​transposed and the diagonal is set to 1 to obtain the upper triangular matrix U.

[0043] In one embodiment, the present application also provides a computer device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the sparse matrix solution method of the above embodiment.

[0044] In one embodiment, the present application also provides a computer storage medium on which a computer program or instruction is stored. When the computer program or instruction is executed by a processor, the steps of the sparse matrix solution method of the above embodiment are implemented.

[0045] In one embodiment, the present application also provides a computer program product, including a computer program or instructions, which implements the steps of the sparse matrix solution method of the above embodiment when the computer program or instructions are executed by a processor.

[0046] In the aforementioned embodiments, the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.

[0047] The memory may be an internal storage unit of the simulation system, such as a hard disk or memory of an intelligent device. The memory may also be an external storage device of an intelligent device, such as a plug-in hard disk equipped on an intelligent device, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card, etc. Further, the memory is used to store computer programs and other programs and data required by the FPGA verification method. The memory may also be used to temporarily store data that has been output or is to be output.

[0048] The communication bus is a circuit that connects the elements described and realizes transmission between these elements. For example, the central processing unit receives commands from other elements through the communication bus, decrypts the received commands, and performs calculations or data processing according to the decrypted commands. The memory may include program modules, such as kernels, middleware, application programming interfaces (APIs) and applications. The program modules may be composed of software, firmware or hardware, or at least two of them. The input / output interface forwards commands or data input by the user through the input / output interface (such as sensors, keyboards, touch screens). The communication interface connects the speed measurement device of the artificial heart with other network devices, user devices, and networks. For example, the communication interface can be connected to the network through wired or wireless connection to connect to other external network devices or user devices. Wireless communication may include at least one of the following sparse matrix solution methods, computer equipment, storage media and program products: wireless fidelity (WiFi), Bluetooth (BT), near field communication technology (NFC), global satellite positioning system (GPS) and cellular communication, etc. Wired communication may include at least one of the following sparse matrix solving methods, computer devices, storage media and program products: Universal Serial Bus (USB), High Definition Multimedia Interface (HDMI), Asynchronous Transmission Standard Interface (RS-232), etc. The network may be a telecommunication network and a communication network. The communication network may be a computer network, the Internet, the Internet of Things, or a telephone network. The verification device of the FPGA may be connected to the network via a communication interface, and the protocol used by the speed measuring device of the artificial heart and other network devices to communicate may be supported by at least one of an application, an application programming interface (API), a middleware, a kernel and a communication interface.

[0049] The transmission line electromagnetic simulation method of the present application can be implemented with program codes executable by a computing device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0050] It should be noted that the above embodiments can be freely combined as needed. The above are only preferred embodiments of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be regarded as the protection scope of the present invention.

Claims

1. A sparse matrix solving method, characterized in that: Includes steps: Obtaining a row exchange matrix and a column exchange matrix corresponding to the original matrix through the original matrix; Performing a matrix transformation on the original matrix according to the row exchange matrix and the column exchange matrix to obtain a first transformation matrix; Generate a union-find set, and traverse the first transformation matrix, and merge the non-zero elements of the first transformation matrix into the union-find set in sequence; generating an elimination tree according to the union-find set, and generating a lower triangular matrix according to the elimination tree; An upper triangular matrix is ​​obtained based on the lower triangular matrix, and a matrix solution is performed according to the upper triangular matrix and the lower triangular matrix.

2. The sparse matrix solving method according to claim 1, characterized in that: The performing matrix transformation on the original matrix according to the row exchange matrix and the column exchange matrix to obtain a first transformation matrix specifically includes: The solution equation for the original matrix is Do the transformation to get Equation, wherein A is the original matrix, P is the row exchange matrix, and Q is the column exchange matrix; The first transformation matrix A1 is obtained, where , then the solution equation of the original matrix is ​​converted to the solution equation.

3. The sparse matrix solving method according to claim 1, characterized in that: The obtaining of the row exchange matrix and the column exchange matrix through the original matrix specifically includes: The original matrix is ​​graph-segmented by a nested partitioning algorithm so that the non-zero elements of the original matrix are gathered near the diagonal of the matrix, and then the original matrix is ​​permuted in rows and columns to obtain the row exchange matrix and the column exchange matrix.

4. The sparse matrix solving method according to claim 2, characterized in that: The generating an elimination tree according to the union-find set, and generating a lower triangular matrix according to the elimination tree, specifically includes: According to the column nodes, query the union-find set in sequence to generate the elimination tree; According to the elimination tree, threads are allocated to nodes of each layer of the elimination tree, so that each thread processes one node, and dependent nodes of each node are searched in the union-find set, and non-zero elements of the dependent nodes of each node are pushed into the stack of the node to obtain non-zero elements of each node; The lower triangular matrix L of the first transformation matrix is ​​obtained according to the non-zero elements of each node in each layer of the elimination tree.

5. The sparse matrix solving method according to claim 4, characterized in that: The nodes at different levels in the elimination tree are synchronously parallelized, and the nodes at the same level are asynchronously parallelized.

6. The sparse matrix solving method according to claim 4, characterized in that: The obtaining of the upper triangular matrix based on the lower triangular matrix specifically includes: According to the elimination tree, threads are assigned to each layer of nodes of the elimination tree, and an outer product calculation is first performed on each node and the dependent nodes corresponding to each node, and then an inner product calculation is performed to obtain the complete lower triangular matrix, and the lower triangular matrix is ​​permuted to obtain the upper triangular matrix U of the first transformation matrix.

7. The sparse matrix solving method according to claim 6, characterized in that: The matrix solution is performed according to the upper triangular matrix and the lower triangular matrix, specifically: pass and Perform matrix solve.

8. A computer device comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the steps of the sparse matrix solving method according to any one of claims 1 to 7.

9. A computer storage medium having a computer program or instruction stored thereon, characterized in that: When the computer program or instruction is executed by a processor, the steps of the sparse matrix solving method according to any one of claims 1 to 7 are implemented.

10. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the sparse matrix solving method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Data processing method and device and device for data processing

    CN113326477A

  • Burnup sparse matrix solving method and system, equipment and storage medium

    CN115080913A

  • Method for calculating equivalent resistance between nodes in resistance network

    CN117391031A

  • Sparse matrix data structure

    US20150067009A1

  • Information processing device, information processing method, and information processing program

    US20160203105A1

Cited By

  • Sparse matrix distributed solution method, computer equipment and storage medium

    CN119808513A