A method for LU mixed precision decomposition of a sparse matrix based on a BBD structure

CN118467902BActive Publication Date: 2026-10-20SHANGHAI HUADA JIUTIAN INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410595272.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-14
Publication Date
2026-10-20
Estimated Expiration
2044-05-14

AI Technical Summary

Technical Problem

但是由于实际的矩阵可能条件数比较差,有可能单精度分解得到的L和U矩阵精度不够,这会使得单精度所得初解的精度比较差,而且会导致refine过程失败,无法得到最终的精确解

Benefits of technology

[0054]通过判断单精度LU分解的精度,把不满足精度要求的单精度的LU分解改为双精度的LU分解,能够用双精度替换掉单精度下少量不精确的L和U矩阵,保留了大多数单精度的L和U矩阵,在LU分解以及回代过程中,既提升了精度也保证了使用单精度运算的效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118467902B_ABST
    Figure CN118467902B_ABST
Patent Text Reader

Abstract

A method for LU mixed precision decomposition of sparse matrix based on BBD structure, comprising: converting the coefficient matrix and the right end item of a linear equation set into BBD structure; performing single-precision LU decomposition on the non-zero element block of the coefficient matrix under the BBD structure to obtain a single-precision LU decomposition matrix; performing precision verification on the single-precision LU decomposition matrix by using a self-checking method, if the precision does not satisfy a preset condition, then re-performing LU decomposition by using double precision, and retaining the LU decomposition matrix satisfying the precision requirement; calculating a Schur complement matrix, and performing single-precision LU decomposition on the Schur complement matrix; performing precision verification on the single-precision LU decomposition matrix of the Schur complement matrix by using a self-checking method, if the precision does not satisfy a preset condition, then re-performing LU decomposition by using double precision, and retaining the LU decomposition matrix satisfying the precision requirement; calculating an initial solution of the linear equation set; and obtaining the solution of the linear equation set by using an improved algorithm according to the retained all LU decomposition matrices and the initial solution.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of circuit simulation technology, and in particular to a method for performing LU mixed-precision decomposition of sparse matrices based on a BBD structure. Background Technology

[0002] In circuit simulation, we often encounter situations where we need to solve large-scale linear algebraic equations, that is...

[0003] Ax=r (1)

[0004] When solving this equation using the direct method, A needs to be decomposed using LU. When the size of A is extremely large, such as when its dimension reaches millions or tens of millions, in order to facilitate parallel computing, matrix A needs to be transformed into a BBD (bordered block diagonal) structure.

[0005] In the BBD architecture, the LU decomposition of a large-scale sparse matrix A is broken down into many smaller matrix LU decompositions, which are then performed independently by various threads. This parallel strategy not only allows for the handling of extremely large-scale matrix decompositions but also significantly improves computational efficiency.

[0006] Transforming a regular sparse matrix into a BBD structure requires partitioning and sorting software, such as metis (metis is a powerful graph partitioning package developed by Karypis Lab, used for partitioning irregular graphs, meshes, and for Fill-ReducingOrderings for sparse matrices). The solution form of the linear equation system under BBD is as follows:

[0007]

[0008] Here A i,j They are all matrix blocks, x i and r i This is a column vector. p is the number of blocks the matrix is ​​divided into; here, only two levels of partitioning were performed. A i,i It is the matrix block corresponding to the internal node, A i,c and A c,i It is the coupling matrix between port nodes and internal nodes in the BBD structure, i = 1, ..., p. A c,c It is the coupling matrix between port nodes in a BBD structure. Corresponding to the partition, x i Let i = 1, ..., p be the solution variables corresponding to the internal nodes, and x be the solution variables. c These are the solution variables corresponding to the port nodes. The right-hand side term r ii = 1, ..., p, is a partition based on the previous division, r c It is the right-hand item corresponding to the port node. By dividing the original large coefficient matrix into many small blocks and sorting them, the pattern shown in formula (2) can be formed.

[0009] To solve the equation in BBD form, we need to modify A. i,i Perform LU decomposition on i = 1, ..., p, i.e.

[0010] A i,i =L i U i , i = 1, ..., p (3)

[0011] Here L i and U i They are respectively for A i,i The lower and upper triangular matrices are obtained after LU decomposition. This process can be processed in parallel using multiple threads. Then, the Schur complement matrix S is calculated. c For the Schul complement matrix S c To perform LU decomposition, the p+1 smaller matrices need to be decomposed p+1 times in order to solve the BBD structure.

[0012] The matrix described above has only been partitioned once. If the matrix is ​​very large, after one partition, each A... i,i The matrix may still have a large dimension, and further adjustments can be made to each A. i,i Continuing with a similar BBD partitioning, we obtain matrices under multiple partitions, ensuring that the size of each matrix block is not too large. In this case, the number of matrices requiring LU decomposition can increase significantly.

[0013] Currently, to improve the efficiency of matrix factorization, one approach is to use single-precision LU decomposition with back substitution to obtain an initial solution in single-precision. Then, preprocessing with single-precision L and U matrices, followed by a refinement process (an improved solution algorithm, essentially a simplified iterative method), yields a more accurate final solution. This method is called mixed-precision LU decomposition. It is more efficient than simply using double-precision LU decomposition while still meeting the accuracy requirements of the final solution. However, because the condition number of the actual matrix may be poor, the precision of the L and U matrices obtained from single-precision decomposition may be insufficient. This results in a poor accuracy of the initial solution obtained from single-precision decomposition and may cause the refinement process to fail, preventing the acquisition of a final accurate solution.

[0014] In order to take advantage of the high efficiency of single-precision computing while overcoming its weakness of poor accuracy, this patent proposes an improved mixed-precision method to solve linear equations under BBD structure. Summary of the Invention

[0015] To address the shortcomings of existing technologies, the present invention aims to provide a method for performing mixed-precision LU decomposition on sparse matrices based on a BBD structure. By determining the precision of single-precision LU decomposition, certain single-precision LU decompositions are converted into double-precision LU decompositions, thereby maintaining the efficiency of mixed-precision solution as much as possible without sacrificing precision.

[0016] To achieve the above objectives, the present invention provides a method for performing LU mixed-precision decomposition of sparse matrices based on a BBD structure, comprising the following steps:

[0017] Transform the coefficient matrix and right-hand side terms of the linear equation system into a BBD structure;

[0018] Single-precision LU decomposition is performed on the non-zero element blocks of the coefficient matrix under the BBD structure to obtain the single-precision LU decomposition matrix;

[0019] The accuracy of the single-precision LU decomposition matrix is ​​verified by a self-checking method. If the accuracy does not meet the preset conditions, the LU decomposition is performed again using double precision, and the LU decomposition matrix that meets the accuracy requirements is retained.

[0020] Calculate the Schur complement matrix and perform single-precision LU decomposition on the Schur complement matrix;

[0021] The accuracy of the single-precision LU decomposition matrix of the Schur complement matrix is ​​verified by a self-testing method. If the accuracy does not meet the preset conditions, the LU decomposition is re-performed using double precision, and the LU decomposition matrix that meets the accuracy requirements is retained.

[0022] Calculate the initial solution of the linear equation system;

[0023] Based on all the retained LU decomposition matrices and the initial solution, the solution to the linear equation system is obtained using an improved solution algorithm.

[0024] Furthermore, after partitioning and sorting the coefficient matrix using the metis software, the coefficient matrix and the corresponding right-hand side terms under the BBD structure are obtained.

[0025] Furthermore, the Schul complement matrix is ​​calculated according to the following formula:

[0026]

[0027] Among them, S c This is the Schul complement matrix.

[0028] Furthermore, the step of using the self-testing method for accuracy verification includes:

[0029] Set an error threshold; select a test vector whose dimension is equal to the dimension of the non-zero element block of the coefficient matrix; calculate the detection vector; calculate the difference between the test vector and the detection vector; compare the difference with the error threshold. If the difference is less than the error threshold, the verification passes, indicating that the precision of the single-precision LU decomposition matrix is ​​sufficient, and the single-precision LU decomposition matrix is ​​retained; otherwise, the verification fails, and the LU decomposition is performed again using the double-precision method to obtain and retain the double-precision LU decomposition matrix.

[0030] Furthermore, the detection vector is calculated using the following formula:

[0031] d = A i,i (L i U i ) -1 c

[0032] Where d is the detection vector, A i,i L represents the non-zero element block of the coefficient matrix under the BBD structure. i and U i A respectively i,i The lower triangular matrix and upper triangular matrix are obtained by performing single-precision LU decomposition, and c is the test vector.

[0033] Furthermore, the difference between the test vector and the detection vector is calculated using the following formula:

[0034]

[0035] Where norm(·) is the norm of the vector, c is the test vector, d is the detection vector, and D measures the difference between the test vector and the detection vector.

[0036] Furthermore, the initial solution of the linear equation system is calculated according to the following formula:

[0037]

[0038]

[0039] Among them, S c This is the Schul complement matrix.

[0040] Furthermore, the improved solution algorithm is as follows:

[0041] i = 0;

[0042] x (0) =P -1 r;

[0043] b = r - Ax (0) ;

[0044] While b does not satisfy the convergence condition

[0045] Δx=P -1 b;

[0046] x (i+1) =x (i) +Δx;

[0047] b = r - Ax (i+1) ;

[0048] i = i + 1;

[0049] end.

[0050] Where P is the preprocessing matrix, which can be a diagonal matrix of the coefficient matrix A, or the product of the L matrix and the U matrix obtained by the LU decomposition of the coefficient matrix A; b represents the residual, r is the right-hand side term of the linear equation system, A is the coefficient matrix of the linear equation system, and x (i) Let represent the solution to the linear equation system obtained in the i-th iteration, and Δx represent the difference between the solutions obtained in two consecutive iterations; when the residual satisfies the convergence condition, x (i) This is the final solution to the system of linear equations.

[0051] To achieve the above objectives, the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor is configured to execute the computer program stored in the memory to implement the method described above for performing LU mixed-precision decomposition of sparse matrices based on the BBD structure.

[0052] To achieve the above objectives, the present invention also provides a computer-readable storage medium storing a computer program, which is loaded and executed by a processor to implement the method for LU mixed-precision decomposition of sparse matrices based on the BBD structure as described above.

[0053] The method for LU mixed-precision decomposition of sparse matrices based on BBD structure provided by this invention has the following advantages compared with the prior art:

[0054] By judging the precision of single-precision LU decomposition, single-precision LU decompositions that do not meet the precision requirements can be converted into double-precision LU decompositions. Double-precision LU decompositions can replace a small number of inaccurate L and U matrices under single-precision LU decomposition, while retaining most of the single-precision L and U matrices. In the process of LU decomposition and back substitution, both the precision is improved and the efficiency of using single-precision operations is guaranteed.

[0055] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. Attached Figure Description

[0056] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used together with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings:

[0057] Figure 1 This is a flowchart of a method for performing LU mixed-precision decomposition of a sparse matrix based on a BBD structure according to an embodiment of the present invention.

[0058] Figure 2 This is a flowchart of the self-testing method according to an embodiment of the present invention;

[0059] Figure 3 This is a schematic diagram illustrating the non-zero element filling of the original coefficient matrix A according to an embodiment of the present invention;

[0060] Figure 4 The BBD structure matrix according to an embodiment of the present invention A schematic diagram of non-zero element filling;

[0061] Figure 5 This is a schematic diagram illustrating the distribution of D values ​​of each matrix obtained by self-testing under single-precision conditions according to an embodiment of the present invention.

[0062] Figure 6 This is a schematic diagram illustrating the distribution of D values ​​of each matrix obtained by self-testing under mixed precision according to an embodiment of the present invention.

[0063] Figure 7 This is a comparison chart of the residuals of solutions obtained under single-precision, double-precision, and mixed-precision conditions according to an embodiment of the present invention;

[0064] Figure 8 This is a schematic diagram of an electronic device structure according to an embodiment of the present invention. Detailed Implementation

[0065] The preferred embodiments of the present invention will be described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.

[0066] Embodiments of the present invention will now be described in more detail with reference to the accompanying drawings. While some embodiments of the invention are shown in the drawings, it should be understood that the invention can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the invention. It should be understood that the accompanying drawings and embodiments are for illustrative purposes only and are not intended to limit the scope of protection of the invention.

[0067] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.

[0068] It should be noted that the concepts of "first" and "second" may be mentioned in this invention only to distinguish different devices, components or parts, and are not used to limit the order of the functions performed by these devices, components or parts or their interdependence.

[0069] It should be noted that the terms "one" and "multiple" used in this invention are illustrative rather than restrictive. Those skilled in the art should understand that, unless explicitly stated otherwise in the context, they should be understood as "one or more". "Multiple" should be understood as two or more.

[0070] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be described in further detail below with reference to the accompanying drawings.

[0071] In this embodiment of the invention, a method for performing LU mixed-precision decomposition of sparse matrices based on a BBD structure is provided, the method comprising:

[0072] Based on the original coefficient matrix A and the right-hand side r of the linear equation system, we obtain the BBD structure. and the right-hand item

[0073] right The internal A i,i Perform single-precision LU decomposition to obtain L i and U i ;

[0074] Using the self-testing method to test L i and U i Perform accuracy verification; if the conditions are not met, re-decompose using double precision.

[0075] Calculate the Schur complement matrix S c ;

[0076] Single-precision decomposition of the Schur complement matrix yields L c and U c ;

[0077] Using the self-test method for L c and U c Perform accuracy verification; if the accuracy is insufficient, re-decompose using double precision.

[0078] Substituting back into the equation yields the initial solution.

[0079] An improved solution algorithm (refine) is used to obtain the exact solution of the original linear equation system.

[0080] Figure 1 The following is a flowchart of a method for performing LU mixed-precision decomposition of a sparse matrix based on a BBD structure according to an embodiment of the present invention. Figure 1 The method for performing LU mixed-precision decomposition of sparse matrices based on the BBD structure in this embodiment is described in detail.

[0081] First, in step 101, the user provides the original coefficient matrix A and the right-hand side r of the linear equation system.

[0082] In this embodiment, the original coefficient matrix A of a circuit at a certain moment in the transient simulation is selected, and its matrix dimension is N = 10254. The non-zero element padding (i.e., non-zero elements) of the original coefficient matrix A is as follows: Figure 3 As shown, a vector of length N was randomly generated as the right-hand side term r.

[0083] In step 102, the BBD structure of matrix A is obtained using partitioning and sorting software. and right end item At this point, matrix A is divided into p blocks. The internal structure of has the form of formula (2).

[0084] In this embodiment, after matrix A is partitioned and sorted using the Metis partitioning software, it becomes... Its non-zero element filling situation is as follows Figure 4 As mentioned above, we have divided the area into 16 blocks, which is p = 16 in formula (2).

[0085] In step 103, for The internal Ai,i is decomposed into L using single-precision LU decomposition. i and U i That is, for A in formula (2) i,i Perform single-precision LU decomposition, which is to calculate using formula (3). Obtain the single-precision L. i and U i , i = 1, ..., p.

[0086] In this embodiment, since matrix A is divided into 16 blocks, it is necessary to process 16 blocks of A. i,i Perform single-precision LU decomposition. This yields 16 sets of single-precision L... i and U i , i = 1, ..., p. Here p = 16.

[0087] In embodiments of the present invention, L is utilized iand U i It can simplify calculations That is, when calculating hour:

[0088]

[0089] And (L) i U i ) -1 L can be used i Lower triangle and U i The properties of the upper triangle are obtained through fast back substitution without actual computation. The display format. Here, B is any matrix or vector.

[0090] Then calculate the Schur complement matrix S c ,Right now:

[0091]

[0092] For the Schul complement matrix S c Perform LU decomposition, that is:

[0093] S c =L c U c (6)

[0094] By solving the following equation:

[0095]

[0096] Get x c Finally, x is obtained through back substitution. i i = 1, ..., p

[0097]

[0098] Thus, in order to solve the BBD structure using LU, it is necessary to perform p+1 LU decompositions on p+1 smaller matrices.

[0099] In step 104, the single precision L is verified using a self-test method. i and U i If the accuracy is not met, then double precision is used to re-decompose the data.

[0100] The self-testing method includes: setting an error threshold ε; selecting a test vector c, whose dimension is equal to A. i,i Calculate the detection vector d; calculate the difference D between the test vector c and the detection vector d; compare the difference D with the error threshold ε. If D < ε, the verification passes, indicating that the single-precision L... i and U i Sufficient precision, retain the original single-precision L i and Ui Otherwise, the verification fails, and a double-precision method is then used to verify A. i,i Decomposition yields double-precision L i and U i Replace the single-precision L that does not meet the accuracy requirements. i and U i .

[0101] Figure 2 The following is a flowchart of the self-testing method according to an embodiment of the present invention, with reference to... Figure 2 The above method uses a self-testing method to verify single precision L. i and U i The method and steps for achieving the required accuracy will be described in further detail.

[0102] In this embodiment, for each group of single-precision L i and U i Accuracy verification is performed using a self-testing method.

[0103] First, in step 201, an error threshold ε is set. In this embodiment, the error threshold ε is set to 0.05.

[0104] In step 202, a test vector c is randomly selected. There are many ways to select the test vector c, such as random generation. Here, we select a test vector c whose components are all 1.

[0105] In step 203, the detection vector d is calculated using formula (9):

[0106] d = A i,i (L i U i ) -1 c (9)

[0107] In step 204, the difference between the detection vector d and the test vector c is calculated. The difference D between c and d is calculated according to formula (10). Since p = 16, we obtain 16 D values.

[0108]

[0109] In step 205, determine the single-precision L. i and U i Does the accuracy meet the requirements? For each calculation, compare D and ε. If D < ε, the verification passes, indicating that the single-precision L... i and U i Sufficient precision, retain the original single-precision L i and U i Otherwise, the verification fails, and a double-precision method is then used to verify A. i,i Decompose to obtain double-precision L i and Ui Replace the single-precision L that does not meet the accuracy requirements. i and U i .

[0110] In this embodiment, only the D calculated by the 7th LU decomposition equals 0.11, which is greater than the error threshold ε. Therefore, only matrix A... 7,7 The double-precision LU decomposition was performed again, yielding double-precision L7 and U7, and other single-precision L7 values. i and U i Save i = 1, ..., p, i ≠ 7 together.

[0111] Continue to refer to Figure 1 In step 105, the Schul complement matrix S is calculated. c Calculate the Schur complement matrix S according to the above formula (5). c In this embodiment, S c Its dimension is only 208.

[0112] In step 106, the Schur complement matrix S is... c Single-precision decomposition yields L c and U c That is, using formula (6).

[0113] In step 107, the above self-test method is used to test the single-precision L. c and U c Perform verification. If the verification passes, then the single-precision L... c and U c If adopted, then use the double-precision method to adjust the Schur complement matrix S. c Re-decompose the LU to obtain the double-precision L. c and U c .

[0114] In step 108, back-substitution is used to calculate the initial solution x0 of the original linear equation. The retained L is then calculated using the steps described above. i and U i i = 1, ..., p and L c and U c By stepwise back substitution, i.e. using the above formulas (7) and (8), the initial solution x0 of the original linear equation is obtained.

[0115] In step 109, the exact solution to the original linear equation is obtained by refining. That is, using L... i and U i i = 1, ..., p and L c and U c And the initial solution x0, and then the refine process is used to obtain the exact solution.

[0116] In an embodiment of the present invention, the process of performing the refine is as follows:

[0117] i = 0;

[0118] x (0) =P -1 r;

[0119] b = r - Ax (0) ;

[0120] While b does not satisfy the convergence condition

[0121] Δx=P -1 b;

[0122] x (i+1) =x (i) +Δx;

[0123] b = r - Ax (i+1) ;

[0124] i = i + 1;

[0125] end.

[0126] Where P is the preprocessing matrix, which can be a diagonal matrix of the coefficient matrix A, or the product of the L matrix and the U matrix obtained by the LU decomposition of the coefficient matrix A. b represents the residual, r is the right-hand side term of the linear equation system, A is the coefficient matrix of the linear equation system, and x... (i) Let represent the solution to the linear equation system obtained in the i-th iteration, and Δx represent the difference between the solutions obtained in two consecutive iterations. When the residual satisfies the convergence condition, x... (i) This is the final solution to the system of linear equations.

[0127] Figure 5 This is a schematic diagram showing the distribution of D values ​​of each matrix obtained by self-testing under single-precision conditions according to an embodiment of the present invention. The horizontal axis corresponds to the matrix, and the vertical axis represents the D value of each matrix. Figure 5 As shown, the distribution of D obtained after self-checking all matrix decompositions in single-precision geometry is presented. The horizontal dashed line in the figure represents the threshold, and the first 16 D values ​​correspond to A. i,i The decomposition of i = 1, ..., 16, the 17th D value corresponds to the Schur complement matrix S. c The decomposition is shown. It can be seen that the D of the 7th matrix exceeds the threshold, and this matrix will be re-decomposed using double precision.

[0128] Figure 6 This is a schematic diagram illustrating the distribution of D values ​​of each matrix obtained by self-testing under mixed precision according to an embodiment of the present invention, as shown below. Figure 6 As shown, the D value of all matrices is less than the threshold.

[0129] Figure 7This is a comparison chart of the residuals obtained under single-precision, double-precision, and mixed-precision conditions according to an embodiment of the present invention. Figure 7 The convergence of various methods during the refinement process is presented, comparing the results obtained under single-precision (float), double-precision, and the mixed-precision decomposition of this invention (this work). The horizontal axis (Iteration number) represents the number of iterations, and the vertical axis (Residu) represents the decrease in residual of the solution during iteration. A smaller Residu indicates higher precision. It can be seen that the convergence speed using the method of this invention is significantly faster than that of using only single-precision decomposition. Figure 7 The bottom dashed line represents the residual of the solution obtained entirely using double-precision calculation. The accuracy of this solution is the limit of the single-precision and mixed-precision methods mentioned above, but the time cost required to obtain the solution is relatively high.

[0130] In embodiments of the present invention, an electronic device is also provided. Figure 8 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention, such as... Figure 8 As shown, the electronic device of the present invention includes a processor 501 and a memory 502, wherein,

[0131] The memory 502 stores a computer program, which, when read and executed by the processor 501, performs the steps described above in the method embodiment for LU mixed-precision decomposition of sparse matrices based on the BBD structure.

[0132] In embodiments of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer program, wherein the computer program is configured to execute the steps in the embodiments of the method for performing LU mixed-precision decomposition of sparse matrices based on BBD structure as described above when running.

[0133] In this embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0134] It will be understood by those skilled in the art that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for LU mixed-precision decomposition of sparse matrices based on BBD structure, applied to the solution of linear equation systems in circuit simulation, characterized in that... Includes the following steps: After partitioning and sorting the coefficient matrix of the linear equation system in the circuit simulation using the metis software, the coefficient matrix and the corresponding right-hand side terms under the BBD structure are obtained. Single-precision LU decomposition is performed in parallel using multiple threads on the non-zero element blocks of the coefficient matrix under the BBD structure to obtain the single-precision LU decomposition matrix. The accuracy of the single-precision LU decomposition matrix is ​​verified by a self-checking method. If the accuracy does not meet the preset conditions, the LU decomposition is performed again using double precision, and the LU decomposition matrix that meets the accuracy requirements is retained. Calculate the Schur complement matrix and perform single-precision LU decomposition on the Schur complement matrix; The accuracy of the single-precision LU decomposition matrix of the Schur complement matrix is ​​verified by a self-testing method. If the accuracy does not meet the preset conditions, the LU decomposition is re-performed using double precision, and the LU decomposition matrix that meets the accuracy requirements is retained. Calculate the initial solution of the linear equation system; Based on all the retained LU decomposition matrices and the initial solution, the solution to the linear equation system is obtained using an improved solution algorithm; The steps for accuracy verification using the self-test method include: Set an error threshold; select a test vector whose dimension is equal to the dimension of the non-zero element block of the coefficient matrix; calculate the detection vector; calculate the difference between the test vector and the detection vector; compare the difference with the error threshold. If the difference is less than the error threshold, the verification passes, indicating that the precision of the single-precision LU decomposition matrix is ​​sufficient, and the single-precision LU decomposition matrix is ​​retained; otherwise, the verification fails, and the LU decomposition is performed again using the double-precision method to obtain and retain the double-precision LU decomposition matrix.

2. The method for performing LU mixed-precision decomposition of sparse matrices based on BBD structure according to claim 1, characterized in that, Calculate the Schul complement matrix using the following formula: in, For the Schul complement matrix, It is the matrix block corresponding to the internal node in the BBD structure. It is the coupling matrix between port nodes in the BBD structure. and It is the coupling matrix between port nodes and internal nodes in a BBD structure. , It is the number of blocks into which the coefficient matrix of the linear equation system is divided.

3. The method for performing LU mixed-precision decomposition of sparse matrices based on BBD structure according to claim 1, characterized in that, The detection vector is calculated using the following formula: in, d For the detection vector, For the non-zero element block of the coefficient matrix under the BBD structure, and They are respectively The lower triangular matrix and upper triangular matrix obtained by performing single-precision LU decomposition. c This is the test vector.

4. The method for performing LU mixed-precision decomposition of sparse matrices based on BBD structure according to claim 1, characterized in that, The difference between the test vector and the detection vector is calculated using the following formula: in, It is the norm of a vector. c For the test vector, d For the detection vector, D Measure the difference between the test vector and the detection vector.

5. The method for performing LU mixed-precision decomposition of sparse matrices based on BBD structure according to claim 1, characterized in that, Calculate the initial solution of the linear equation system using the following formula: in, For the Schul complement matrix, It is the number of blocks into which the coefficient matrix of the linear equation system is divided. It is the matrix block corresponding to the internal node. and It is the coupling matrix between port nodes and internal nodes in a BBD structure. ; It is the coupling matrix between port nodes in the BBD structure; corresponding to the partitioning, , are the solution variables corresponding to the internal nodes, and These are the solver variables corresponding to the port nodes; right-hand side terms This involves partitioning the right-hand side of the linear equation system based on the division of the coefficient matrix. It is the right-hand item corresponding to the port node.

6. The method for performing LU mixed-precision decomposition of sparse matrices based on BBD structure according to claim 1, characterized in that, The improved solution algorithm is as follows: i =0; ; ; While The convergence condition is not met. ; ; ; ; end. in, P For the preprocessing matrix, P It can be a coefficient matrix A diagonal matrix, or coefficient matrix A LU decomposition obtained Matrix and Matrix product; b Represents the residual. r For the right-hand side of the system of linear equations, A The coefficient matrix of the linear equation system. Indicates the first i The solution to the system of linear equations obtained in the second iteration. This represents the difference between the solutions obtained from two consecutive iterations; when the residual satisfies the convergence condition, This is the final solution to the system of linear equations.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor is configured to execute the computer program stored in the memory to implement the method for LU mixed-precision decomposition of sparse matrices based on BBD structure as described in any one of claims 1-6.

8. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which is loaded and executed by a processor to implement the method for LU mixed-precision decomposition of sparse matrices based on BBD structure as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Method for solving reservoir simulation matrix equation using parallel multi-level incomplete factorizations

    CN102138146A

  • Deleted graph-based parallel decomposition method for circuit sparse matrix in circuit simulation

    CN102156777A