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

Through the generation of union search and elimination trees, it is converted into a lower triangular matrix, which solves the problems of instability and slow iteration speed of the iterative method in solving ill-conditioned matrices, and achieves fast solution of sparse matrices and improvement of simulation efficiency.

CN119025811BActive Publication Date: 2025-01-21JULIN TECH (SHANGHAI) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In circuit and electromagnetic simulation in the EDA field, iterative methods are difficult to converge to a stable solution, especially when encountering pathological matrices, the solution is unstable and iterative speed is slow, and preprocessing is required to accelerate convergence.

Method used

By generating a union-find set and traversing the non-zero elements of the sparse matrix, merging them into the union-find set, generating an elimination tree, converting it into a lower triangular matrix, and then solving the matrix.

Benefits of technology

The time complexity of calculation is reduced from O(n2) to O(n), enabling fast solutions to symmetric matrices and complex conjugate matrices, and improving calculation and simulation efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119025811B_ABST
    Figure CN119025811B_ABST
Patent Text Reader

Abstract

The present invention provides a sparse matrix solution method, computer equipment, storage medium and program product. The method includes the following steps: obtaining a row exchange matrix and a column exchange matrix corresponding to the original matrix through an original matrix; performing matrix transformation on the original matrix according to the row exchange matrix and the column exchange matrix to obtain a first transformation matrix; generating a union-find set, traversing the first transformation matrix, and sequentially merging the non-zero elements of the first transformation matrix into the union-find set; generating an elimination tree according to the union-find set, and generating a lower triangular matrix according to the elimination tree; 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. The scheme can realize the rapid solution of symmetric matrices and complex conjugate matrices, and can reduce the time complexity of calculation, thereby improving the efficiency of calculation and simulation.
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:

[0005] The present invention provides a sparse matrix solving method, comprising the steps of:

[0006] Obtaining a row exchange matrix and a column exchange matrix corresponding to the original matrix through the original matrix;

[0007] 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;

[0008] 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;

[0009] generating an elimination tree according to the union-find set, and generating a lower triangular matrix according to the elimination tree;

[0010] 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.

[0011] 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.

[0012] 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:

[0013] 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;

[0014] The first transformation matrix A1 is obtained, where , then the solution equation of the original matrix is ​​converted to the solution equation.

[0015] In some implementations, obtaining a row switching matrix and a column switching matrix through an original matrix specifically includes:

[0016] 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.

[0017] 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:

[0018] According to the column nodes, query the union-find set in sequence to generate the elimination tree;

[0019] 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;

[0020] 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.

[0021] 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.

[0022] In some implementations, obtaining an upper triangular matrix based on the lower triangular matrix specifically includes:

[0023] 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.

[0024] In some implementations, performing matrix solving according to the upper triangular matrix and the lower triangular matrix is ​​specifically:

[0025] pass and Perform matrix solve.

[0026] 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.

[0027] 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.

[0028] 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.

[0029] 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

[0030] 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.

[0031] Figure 1 It is a schematic diagram of the overall process of an embodiment of the present invention;

[0032] Figure 2 It is a flow chart of an embodiment of the present invention. DETAILED DESCRIPTION

[0033] 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.

[0034] 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".

[0035] 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.

[0036] 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.

[0037] 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.

[0038] 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.

[0039] 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.

[0040] 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.

[0041] 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.

[0042] 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:

[0043] In one embodiment, the reference specification Figure 1 The present invention provides a sparse matrix solving method, comprising the steps of:

[0044] S100, obtaining a row exchange matrix and a column exchange matrix corresponding to the original matrix through the original matrix;

[0045] 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;

[0046] 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;

[0047] S400, generating an elimination tree according to the union-find set, and generating a lower triangular matrix according to the elimination tree;

[0048] 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.

[0049] 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.

[0050] 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:

[0051] 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 A1, where , then the solution equation of the original matrix is ​​transformed into the solution equation.

[0052] 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.

[0053] 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.

[0054] 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.

[0055] 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.

[0056] 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.

[0057] 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.

[0058] In a specific implementation, the matrix solution is performed according to the upper triangular matrix and the lower triangular matrix, specifically:

[0059] 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.

[0060] 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.

[0061] In one embodiment, based on the above embodiment, obtaining a row switching matrix and a column switching matrix through an original matrix specifically includes:

[0062] 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.

[0063] 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:

[0064] S410, query and find the set in sequence according to the column nodes to generate an elimination tree;

[0065] 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;

[0066] 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.

[0067] 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.

[0068] Preferably, obtaining an upper triangular matrix based on a lower triangular matrix specifically includes:

[0069] 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.

[0070] 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.

[0071] 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.

[0072] 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.

[0073] 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.

[0074] 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.

[0075] 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.

[0076] 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.

[0077] 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.

[0078] 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 for matrix calculation in EDA circuit and electromagnetic field simulation process, characterized in that: Includes steps: Obtaining a row exchange matrix and a column exchange matrix corresponding to the original matrix through the original matrix, specifically comprising: performing graph segmentation on the original matrix through a nested partitioning algorithm so that non-zero elements of the original matrix are gathered near the diagonal of the matrix, and then performing row and column permutation on the original matrix to obtain the row exchange matrix and the column exchange 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 specifically includes: solving the equation of the original matrix 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; obtain the first transformation matrix ,in, Then the solution equation of the original matrix is ​​converted into the solution equation; 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; Generate an elimination tree according to the union-find set, and generate a lower triangular matrix according to the elimination tree, specifically including: query the union-find set in sequence according to the column nodes to generate the elimination tree; assign threads to each layer of nodes of the elimination tree according to the elimination tree, so that each thread processes one node, and search for dependent nodes of each node in the union-find set, push the non-zero elements of the dependent nodes of each node into the stack of the node, and obtain the non-zero elements of each node; obtain the lower triangular matrix L of the first transformation matrix according to the non-zero elements of each node in each layer of nodes of 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, wherein obtaining 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.

2. The sparse matrix solving method according to claim 1, 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.

3. The sparse matrix solving method according to claim 1, 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.

4. 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 3.

5. 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 3 are implemented.

6. 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 3 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