Data processing method, apparatus, computer device and program product

WO2026174769A1PCT designated stage Publication Date: 2026-08-27HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/120740
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2025-02-24
Filing Date
2025-09-11
Publication Date
2026-08-27

Smart Images

  • Figure CN2025120740_27082026_PF_FP_ABST
    Figure CN2025120740_27082026_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present application relate to the technical field of big data. Disclosed are a data processing method, an apparatus, a computer device, and a program product. In the embodiments of the present application, upon acquiring a target coefficient matrix and a target constant matrix that correspond to a target triangular matrix equation system to be solved, an inverse matrix of each of a plurality of sub-triangular matrices comprised in the target coefficient matrix is determined by means of a matrix inversion algorithm; subsequently, on the basis of said inverse matrix and the target constant matrix, the solution to the target triangular matrix equation system can be directly determined by means of a matrix multiplication algorithm. The solution is applicable to scenarios involving large‑scale coefficient matrices, and the entire solving process can be totally implemented by means of matrix operations. Therefore, the efficiency of solving a target triangular matrix equation system is improved, thereby improving the computing capability of a processor.
Need to check novelty before this filing date? Find Prior Art

Description

Data processing methods, apparatus, computer equipment and software products

[0001] This application claims priority to Chinese Patent Application No. 202510207300.5, filed on February 24, 2025, entitled “Data Processing Method, Apparatus, Computer Equipment and Program Product”, the entire contents of which are incorporated herein by reference. Technical Field

[0002] This application relates to the field of big data technology, and in particular to a data processing method, apparatus, computer equipment, and program product. Background Technology

[0003] In fields such as machine learning, computer graphics, and signal processing, many problems involving numerical solutions can be transformed into solving systems of triangular matrix equations. A system of triangular matrix equations can be understood as a matrix composed of the coefficients of the unknowns to be solved, which is either an upper triangular matrix or a lower triangular matrix. Improving computational efficiency in solving systems of triangular matrix equations is a key consideration. Summary of the Invention

[0004] This application provides a data processing method, apparatus, computer equipment, and program product that can improve the efficiency of solving triangular matrix equations. The technical solution is as follows:

[0005] Firstly, a data processing method is provided, in which the target coefficient matrix and target constant matrix corresponding to the target triangular matrix equation system are obtained; the inverse matrix of each of the multiple sub-triangular matrices included in the target coefficient matrix is ​​determined by a matrix inversion algorithm, and the element at the diagonal position of each sub-triangular matrix is ​​the element at the diagonal position of the target coefficient matrix; based on the inverse matrix of each sub-triangular matrix and the target constant matrix, the solution of the target triangular matrix equation system is determined by a matrix multiplication algorithm.

[0006] In the data processing method provided in this application embodiment, after obtaining the target coefficient matrix and target constant matrix corresponding to the target triangular matrix equation system to be solved, the inverse matrix of each of the multiple sub-triangular matrices included in the target coefficient matrix is ​​determined by a matrix inversion algorithm. Subsequently, the solution to the target triangular matrix equation system can be directly determined by a matrix multiplication algorithm based on the inverse matrix of each of the multiple sub-triangular matrices and the target constant matrix. This scheme is not only applicable to scenarios with large coefficient matrices, but also the entire solution process can be implemented entirely through matrix operations, thus improving the efficiency of solving the target triangular matrix equation system and thereby enhancing the processor's computing power.

[0007] Based on the method provided in the first aspect, in one possible implementation, the total number of elements at the diagonal positions of each sub-triangular matrix is ​​n, where n is greater than 1 and less than m, and m is the number of rows in the target coefficient matrix.

[0008] That is, the size of each sub-triangular matrix is ​​n×n. In the embodiments of this application, the sizes of different sub-triangular matrices in the multiple sub-triangular matrices can be the same or different, and this embodiment of the application does not limit this.

[0009] Based on the method provided in the first aspect, in one possible implementation, the multiple sub-triangular matrices include the first sub-triangular matrix.

[0010] In this scenario, the implementation of determining the inverse matrix of each of the multiple sub-triangular matrices included in the target coefficient matrix using a matrix inversion algorithm can be as follows:

[0011] Construct a system of equations for the first sub-triangular matrix, where the first sub-triangular matrix is ​​the coefficient matrix of the system of equations and the constant matrix of the system of equations is the identity matrix. Solve the system of equations for the first sub-triangular matrix and use the solution of the system of equations for the first sub-triangular matrix as the inverse matrix of the first sub-triangular matrix.

[0012] The solution process does not require the participation of the target constant matrix; it can be solved solely by the sub-triangular matrix itself, thus avoiding the need to call the target constant matrix multiple times during the solution process.

[0013] Based on the method provided in the first aspect, in one possible implementation, the solution to the system of triangular matrix equations is determined by matrix multiplication using the inverse matrix of each of the multiple sub-triangular matrices and the target constant matrix.

[0014] Based on the partitioning method of multiple sub-triangular matrices, the target constant matrix is ​​divided into multiple sub-constant matrices, resulting in multiple sub-constant matrices corresponding to each of the multiple sub-triangular matrices. The number of rows in each sub-constant matrix is ​​the same as the number of columns in the corresponding sub-triangular matrix. The multiple sub-triangular matrices are then arranged in order according to their column positions in the target coefficient matrix. The inverse of the first sorted sub-triangular matrix is ​​multiplied by the corresponding sub-constant matrix to obtain the solution for the unknown corresponding to the first sub-triangular matrix. For the i-th sorted sub-triangular matrix (i > 1), the sub-constant matrix corresponding to the i-th sub-triangular matrix is ​​updated based on the solutions for the unknowns corresponding to the first to the (i-1)-th sub-triangular matrices. The inverse of the i-th sub-triangular matrix is ​​then multiplied by the updated sub-constant matrix corresponding to the i-th sub-triangular matrix to obtain the solution for the unknown corresponding to the i-th sub-triangular matrix.

[0015] By employing the above method, without altering the basic flow of the TRSM algorithm, the solution for the unknowns corresponding to each sub-triangular matrix can be directly obtained through matrix multiplication. The sub-constant matrix corresponding to the next sub-triangular matrix is ​​then updated based on the solved solutions, and the solution for the unknowns corresponding to the next sub-triangular matrix is ​​obtained. Thus, iterative methods are unnecessary in solving the unknowns for each sub-triangular matrix, thereby improving computational efficiency.

[0016] Based on the method provided in the first aspect, in one possible implementation, the multiple sub-triangular matrices include a second sub-triangular matrix and a fourth sub-triangular matrix, and the column position of the second sub-triangular matrix in the target coefficient matrix is ​​earlier than the column position of the third sub-triangular matrix in the target coefficient matrix.

[0017] Specifically, when the target coefficient matrix is ​​a lower triangular matrix, the second sub-triangular matrix is ​​ordered before the third sub-triangular matrix; or, when the target coefficient matrix is ​​an upper triangular matrix, the second sub-triangular matrix is ​​ordered after the third sub-triangular matrix.

[0018] The sub-triangular matrices are arranged in order according to their column positions in the target coefficient matrix. The specific sorting method depends on the type of the target coefficient matrix.

[0019] Secondly, a data processing apparatus is provided, which has the function of implementing the data processing method behavior described in the first aspect. The data processing apparatus includes at least one module for implementing the data processing method provided in the first aspect. For example, the data processing apparatus includes the following module:

[0020] The acquisition module is used to acquire the target coefficient matrix and target constant matrix corresponding to the target triangular matrix equation system;

[0021] The first determining module is used to determine the inverse matrix of each of the multiple sub-triangular matrices included in the target coefficient matrix through a matrix inversion algorithm, wherein the element at the diagonal position of each sub-triangular matrix is ​​the element at the diagonal position of the target coefficient matrix.

[0022] The second determining module is used to determine the solution of the target triangular matrix equation system by matrix multiplication algorithm based on the inverse matrix of each of the multiple sub-triangular matrices and the target constant matrix.

[0023] Based on the apparatus provided in the second aspect, in one possible implementation, the total number of elements at the diagonal positions of each sub-triangular matrix is ​​n, where n is greater than 1 and less than m, and m is the number of rows in the target coefficient matrix.

[0024] Based on the apparatus provided in the second aspect, in one possible implementation, the plurality of sub-triangular matrices include a first sub-triangular matrix; the first determining module is configured to:

[0025] Construct a system of equations for the first sub-triangular matrix, where the first sub-triangular matrix is ​​the coefficient matrix of the system of equations and the constant matrix of the system of equations is the identity matrix. Solve the system of equations for the first sub-triangular matrix and use the solution of the system of equations for the first sub-triangular matrix as the inverse matrix of the first sub-triangular matrix.

[0026] Based on the apparatus provided in the second aspect, in one possible implementation, the second determining module is used for:

[0027] Based on the partitioning method of multiple sub-triangular matrices, the target constant matrix is ​​divided into multiple sub-constant matrices, resulting in multiple sub-constant matrices corresponding to the multiple sub-triangular matrices respectively. The number of rows in each sub-constant matrix is ​​the same as the number of columns in the corresponding sub-triangular matrix.

[0028] Arrange the multiple sub-triangular matrices in order according to their column positions in the target coefficient matrix, and multiply the inverse of the first sorted sub-triangular matrix with the corresponding sub-constant matrix to obtain the solution for the unknown corresponding to the first sub-triangular matrix.

[0029] For the sorted i-th sub-triangular matrix (i > 1), update the sub-constant matrix corresponding to the i-th sub-triangular matrix based on the solutions to the unknowns corresponding to the i-th (i-1)-th sub-triangular matrices. Then multiply the inverse matrix of the i-th sub-triangular matrix with the updated sub-constant matrix corresponding to the i-th sub-triangular matrix to obtain the solution to the unknowns corresponding to the i-th sub-triangular matrix.

[0030] Based on the apparatus provided in the second aspect, in one possible implementation, the plurality of sub-triangular matrices include a second sub-triangular matrix and a fourth sub-triangular matrix, and the column position of the second sub-triangular matrix in the target coefficient matrix is ​​earlier than the column position of the third sub-triangular matrix in the target coefficient matrix;

[0031] When the target coefficient matrix is ​​a lower triangular matrix, the order of the second sub-triangular matrix precedes the order of the third sub-triangular matrix; or,

[0032] When the target coefficient matrix is ​​an upper triangular matrix, the order of the second sub-triangular matrix follows the order of the third sub-triangular matrix.

[0033] Thirdly, a computer device is provided, comprising a processor and a memory. The memory stores programs that support the computer device in executing the data processing method provided in the first aspect, and stores data related to implementing the data processing method provided in the first aspect. The processor is configured to execute the programs stored in the memory.

[0034] Fourthly, a computer-readable storage medium is provided, wherein instructions are stored therein, which, when executed on a computer device, cause the computer device to perform the data processing method described in the first aspect.

[0035] Fifthly, a computer program product containing instructions is provided, which, when run on a computer device, causes the computer device to perform the data processing method described in the first aspect.

[0036] The technical effects achieved by the corresponding technical means in the second to fifth aspects mentioned above are similar, and will not be repeated here. Attached Figure Description

[0037] Figure 1 is a schematic diagram of the TRSM algorithm.

[0038] Figure 2 is a schematic diagram of the structure of a computing device provided in an embodiment of this application;

[0039] Figure 3 is a schematic diagram of another computing device provided in an embodiment of this application;

[0040] Figure 4 is a flowchart of a data processing method provided in an embodiment of this application;

[0041] Figure 5 is a comparative schematic diagram of a solution provided in an embodiment of this application;

[0042] Figure 6 is a schematic diagram of the structure of a data processing device provided in an embodiment of this application. Detailed Implementation

[0043] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.

[0044] Before explaining the embodiments of this application, the application scenarios involved in the embodiments of this application will be introduced first.

[0045] Currently, many fields involve solving systems of linear equations when processing data. For example, in machine learning, solving systems of linear equations allows for the efficient training of linear regression models. In computer graphics, it enables the optimization of graphics transformations and lighting calculations. In signal processing, it improves filtering and facilitates signal recovery. And in engineering simulation, it accelerates finite element analysis and enables structural optimization.

[0046] In this context, solving any system of linear equations can ultimately be transformed into solving a system of triangular matrix equations. A system of triangular matrix equations can be exemplified as: A*X = B. A is the coefficient matrix corresponding to the triangular matrix equation system. A can be an upper triangular matrix or a lower triangular matrix. In an upper triangular matrix, all elements at the diagonal positions and above the diagonal positions are non-zero, and all elements below the diagonal positions are zero. In a lower triangular matrix, all elements at the diagonal positions and below the diagonal positions are non-zero, and all elements above the diagonal positions are zero. B is the constant matrix corresponding to the triangular matrix equation system.

[0047] Currently, solving systems of triangular matrix equations can be achieved using the following two algorithms.

[0048] (1) Triangular matrix multiplication (TRMM) algorithm. The principle of the TRMM algorithm is as follows: For the coefficient matrix A of the triangular matrix equation system to be solved, first perform the inverse operation on the coefficient matrix A to obtain the inverse matrix A. -1 Then the inverse matrix A -1 Multiplying by the constant matrix of the triangular matrix equation system, i.e., A -1 By multiplying by B, we can obtain the solution for each unknown in the triangular matrix equation system.

[0049] The TRMM algorithm is suitable for scenarios where the coefficient matrix A is relatively small. In scenarios where the coefficient matrix A is large, the processor overhead required to invert the entire coefficient matrix A is very high, which can easily lead to a decrease in processor computing performance.

[0050] (2) Triangular Solve Matrix (TRSM) Algorithm. Figure 1 is a schematic diagram of the TRSM algorithm. Figure 1 uses a lower triangular matrix as an example to illustrate the principle of the triangular matrix equation system. As shown in Figure 1, for the coefficient matrix A of the triangular matrix equation system to be solved, assuming that A is a lower triangular matrix, the coefficient matrix A is divided into multiple parts at fixed intervals, such as 16 rows. Each of these parts forms a 16×16 sub-triangular matrix near its diagonal. The constant matrix is ​​also divided into multiple parts at fixed intervals, such as 16 rows, called multiple sub-constant matrices.

[0051] For the topmost sub-triangular matrix (i.e., the first sub-triangular matrix A1) of the partitioned coefficient matrix A, combined with the corresponding sub-constant matrix (i.e., the first sub-triangular matrix B1) in the constant matrix, the solutions for each unknown corresponding to the sub-triangular matrix are obtained through an iterative method, i.e., x1 to x... 16 The solution. This process can be called solve computation.

[0052] After obtaining the solutions for each unknown corresponding to the first sub-triangular matrix, the sub-constant matrix corresponding to each sub-triangular matrix, starting from the second sub-triangular matrix, is updated based on the solutions for each unknown corresponding to the first sub-triangular matrix and the elements of the first 16 columns of the coefficient matrix. This process can be called matrix update.

[0053] For the second sub-triangular matrix in the partitioned coefficient matrix A, the same solve calculation and matrix update process described above is used to solve for the solutions to the unknowns corresponding to the second sub-triangular matrix. This process is repeated until the solutions to the unknowns corresponding to all sub-triangular matrices are obtained.

[0054] The TRSM algorithm is suitable for scenarios where the coefficient matrix A is relatively large, avoiding the processor performance degradation caused by processing large matrices by splitting the coefficient matrix. However, in the TRSM algorithm, for each sub-triangular matrix, it is necessary to combine a constant matrix and use an iterative method to solve for some unknowns. This process cannot be implemented through matrix operations, resulting in low efficiency in the solution process.

[0055] Based on this, this application provides a data processing method. In this method, after obtaining the target coefficient matrix and target constant matrix corresponding to the target triangular matrix equation system to be solved, the inverse matrix of each sub-triangular matrix among the multiple sub-triangular matrices included in the target coefficient matrix is ​​determined using a matrix inversion algorithm. Subsequently, based on the inverse matrix of each sub-triangular matrix and the target constant matrix, the solution to the target triangular matrix equation system can be directly determined using a matrix multiplication algorithm. This scheme is not only applicable to scenarios with large coefficient matrices, but also allows the entire solution process to be implemented entirely through matrix operations, thus improving the efficiency of solving the target triangular matrix equation system and thereby enhancing the processor's computing power.

[0056] The hardware devices, data processing methods, and related apparatuses provided in the embodiments of this application will be described in detail below.

[0057] Figure 2 is a schematic diagram of a computing device provided in an embodiment of this application. The computing device 2 includes a processor 20, and the processor 20 includes a cube unit 201, which is used to implement the data processing method provided in the embodiment of this application.

[0058] The processor 20 can be, for example, a central processing unit (CPU), a graphics processing unit (GPU), or a neural network processing unit (NPU). This application does not limit the type of processor including the matrix calculation unit.

[0059] The matrix calculation unit 201 can be understood as a module for performing matrix calculations, such as matrix inversion, matrix multiplication, or matrix addition and subtraction. In this embodiment, the matrix calculation unit 201 can be implemented in hardware; in this scenario, the matrix calculation unit can also be called matrix acceleration hardware. Optionally, the matrix calculation unit 201 can also be implemented in software. Optionally, the matrix calculation unit 201 can also be implemented through a combination of software and hardware. This embodiment does not limit the implementation method of the matrix calculation unit.

[0060] It should be noted that Figure 2 shows a matrix calculation unit 201 in the processor 20. In this embodiment, the processor 20 may include more matrix calculation units 201. Different matrix calculation units are used to implement different matrix calculations. This embodiment does not limit this.

[0061] Furthermore, Figure 2 illustrates the execution entity of an embodiment of this application using a computing device as an example. Optionally, when applying the embodiments of this application, different steps can be implemented by processors in different computing devices. The embodiments of this application do not limit this, and will not be illustrated in detail here.

[0062] Figure 3 is a schematic diagram of another computing device provided in an embodiment of this application. As shown in Figure 3, the computing device includes at least one processor 301, a communication bus 302, a memory 303, and at least one communication interface 304.

[0063] The processor 301 includes a matrix calculation unit for implementing the data processing method provided in the embodiments of this application.

[0064] The memory 303 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or it may be an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital versatile optical discs, Blu-ray discs, etc.), a magnetic disk or other magnetic storage device, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but is not limited thereto. The memory 303 may exist independently and be connected to the processor 301 via a communication bus 302. The memory 303 may also be integrated with the processor 301.

[0065] The memory 303 stores program code for executing the scheme of this application, and its execution is controlled by the processor 301. The processor 301 executes the program code stored in the memory 303. The program code may include one or more software modules. The foregoing embodiments can use the processor 301 and one or more software modules in the program code in the memory 303 to determine the data used for application development.

[0066] Communication interface 304 uses any transceiver-like device for communicating with other devices or communication networks, such as Ethernet, radio access network (RAN), wireless local area network (WLAN), etc.

[0067] In a specific implementation, as one embodiment, the computing device may include multiple processors, such as processor 301 and processor 305 shown in FIG. 3. Each of these processors may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. Here, a processor may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).

[0068] In a specific implementation, as one embodiment, the computing device may further include an output device 306 and an input device 307. The output device 306 communicates with the processor 301 and can display information in various ways. For example, the output device 306 may be a liquid crystal display (LCD), a light-emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector, etc. The input device 307 communicates with the processor 301 and can receive user input in various ways. For example, the input device 307 may be a mouse, a keyboard, a touchscreen device, or a sensing device, etc.

[0069] The aforementioned computing device can be a general-purpose computer or a special-purpose computer. In specific implementations, the computing device can be a desktop computer, a portable computer, a network server, a handheld digital assistant (PDA), a mobile phone, a tablet computer, a wireless terminal device, a communication device, or an embedded device. Optionally, the computing device can also be a computing node in a cloud platform that provides computing capabilities. This application does not limit the type of computing device.

[0070] Figure 4 is a flowchart of a data processing method provided in an embodiment of this application. This method exemplarily applies the matrix calculation unit shown in Figure 2. As shown in Figure 4, the method includes the following steps.

[0071] Step 401: Obtain the target coefficient matrix and target constant matrix corresponding to the target triangular matrix equation system.

[0072] In some embodiments, when a processor in a computing device is processing numerical problems in certain fields, it can convert the linear equations to be solved into a triangular matrix equations and use the triangular matrix equations as the target triangular matrix equations, and then output the solution of the target triangular matrix equations through a matrix computation unit.

[0073] In other words, the target triangular matrix equation system in this application embodiment can be any triangular matrix equation system to be solved. When the processor needs to solve the target triangular matrix equation system, it can call the matrix calculation unit to solve the target triangular matrix equation system through the matrix calculation unit.

[0074] The target triangular matrix equation system includes information in three dimensions: the target coefficient matrix A, the target unknown matrix X, and the target constant matrix B. The target coefficient matrix A can be either an upper triangular matrix or a lower triangular matrix.

[0075] For example, the target coefficient matrix A has a size of m×m, meaning it is an upper or lower triangular matrix with m rows and m columns. The target unknown matrix X has a size of m×1, meaning it is a vector with m rows and 1 column, which can be represented as x1 to x... m In other words, the number of unknowns in the system of equations for the target triangular matrix is ​​m. The size of the target constant matrix B is m×C, that is, the target constant matrix B is a matrix with m rows and C columns.

[0076] Where C is greater than or equal to 1, when C equals 1, it means that the target constant matrix B in the target triangular matrix equation system is a column vector, and the solution obtained is a set of x1 to x2 corresponding to that column vector. m The solution. When C is greater than 1, it means that the target constant matrix B in the target triangular matrix equation system includes multiple column vectors. In this case, the solution includes a set of x1 to x2 corresponding to each column vector. m The solution. For example, if C equals 2, and the objective constant matrix B includes two column vectors, b1 and b2, then the principle of the solution process is: let A*X = b1 to obtain a set of x1 to x2 corresponding to b1. m The solution is to let A*X = b2 to obtain a set of x1 to x2 corresponding to b2. m The solution.

[0077] Step 402: Determine the inverse matrix of each of the multiple sub-triangular matrices included in the target coefficient matrix using a matrix inversion algorithm. The elements at the diagonal positions of each sub-triangular matrix are the elements at the diagonal positions of the target coefficient matrix.

[0078] In this embodiment, to address the issue that the TRMM algorithm is unsuitable for large-scale coefficient matrices, multiple sub-triangular matrices are divided from the target coefficient matrix. The inverse of each sub-triangular matrix is ​​solved before solving the target triangular matrix using the target constant matrix. Since each sub-triangular matrix is ​​relatively small, the processor overhead required to solve the inverse of each sub-triangular matrix is ​​also relatively low, thus enabling the data processing method provided in this embodiment to be applied to scenarios with large-scale coefficient matrices.

[0079] In this application, the sizes of different sub-triangular matrices within the multiple sub-triangular matrices can be the same or different, and this embodiment does not limit this. The following explanation will use the example of different sub-triangular matrices having the same size within the multiple sub-triangular matrices.

[0080] In some embodiments, it is assumed that the target coefficient matrix A is m×m in size, and the total number of elements at the diagonal position of each sub-triangular matrix is ​​n, that is, the size of each sub-triangular matrix is ​​n×n.

[0081] For example, for the m elements at the diagonal position of the target coefficient matrix A, divide them into groups of n elements every n elements from the top left to the bottom right. Construct a sub-triangular matrix with each group of elements as the diagonal element, and then obtain multiple sub-triangular matrices.

[0082] For example, if m is 256 and n is 16, then 16 sub-triangular matrices can be obtained through the above method. Each sub-triangular matrix is ​​16×16 in size, and each sub-triangular matrix can be understood as a matrix composed of a portion of the elements in the target coefficient matrix. In this scenario, the sub-triangular matrix obtained can be referenced from the sub-triangular matrix in Figure 1.

[0083] In some embodiments, the following explanation uses the first sub-triangular matrix included in multiple sub-triangular matrices as an example to illustrate how to determine the inverse matrix of each sub-triangular matrix. In this scenario, the matrix computation unit determines the inverse matrix of each sub-triangular matrix among the multiple sub-triangular matrices included in the target coefficient matrix using a matrix inversion algorithm as follows: Construct a system of equations for the first sub-triangular matrix corresponding to the first sub-triangular matrix, where the first sub-triangular matrix is ​​the coefficient matrix corresponding to the system of equations for the first sub-triangular matrix, and the constant matrix corresponding to the system of equations for the first sub-triangular matrix is ​​the identity matrix; solve the system of equations for the first sub-triangular matrix, and use the solution of the system of equations for the first sub-triangular matrix as the inverse matrix of the first sub-triangular matrix.

[0084] The solution process does not require the participation of the target constant matrix; it can be solved solely by the sub-triangular matrix itself, thus avoiding the need to call the target constant matrix multiple times during the solution process.

[0085] For example, if the first sub-triangular matrix is ​​labeled A1, then the above system of equations for the first sub-triangular matrix can be expressed as: A1*X=I, where I is the identity matrix. Solving A1*X=I, the resulting X is the inverse matrix of the first sub-triangular matrix A1.

[0086] Alternatively, in this embodiment, the inverse matrix of the first subtriangular matrix can also be solved by other matrix calculation methods, which will not be illustrated here.

[0087] Furthermore, since the inversion processes of different sub-triangular matrices are independent of each other, the inverse matrix of each sub-triangular matrix can be calculated in parallel when applying the embodiments of this application, which can further improve computational efficiency. Optionally, when the matrix computation unit has limited capabilities, the inverse matrix of each sub-triangular matrix can also be calculated sequentially one by one, which will not be illustrated here.

[0088] After solving for the inverse of each sub-triangular matrix, the matrix calculation unit can further store the inverse of each sub-triangular matrix. This application embodiment does not limit the storage location of the inverse of each sub-triangular matrix.

[0089] Step 403: Based on the inverse matrix of each sub-triangular matrix and the target constant matrix, determine the solution of the target triangular matrix equation system using a matrix multiplication algorithm.

[0090] In some embodiments, the matrix calculation unit determines the solution of the triangular matrix equation system by matrix multiplication based on the inverse matrix of each of the multiple sub-triangular matrices and the target constant matrix. The implementation method is as follows: The target constant matrix is ​​divided into multiple sub-constant matrices according to the partitioning method of the multiple sub-triangular matrices, resulting in multiple sub-constant matrices corresponding to each of the multiple sub-triangular matrices. The number of rows in each sub-constant matrix is ​​the same as the number of columns in the corresponding sub-triangular matrix. The multiple sub-triangular matrices are arranged in order according to their column positions in the target coefficient matrix, and the inverse matrix of the first sorted sub-triangular matrix is ​​multiplied by the corresponding sub-constant matrix to obtain the solution for the unknown corresponding to the first sub-triangular matrix. For the i-th sorted sub-triangular matrix (i > 1), the sub-constant matrix corresponding to the i-th sub-triangular matrix is ​​updated based on the solutions for the unknowns corresponding to the first to the (i-1)-th sub-triangular matrices. The inverse matrix of the i-th sub-triangular matrix is ​​then multiplied by the updated sub-constant matrix corresponding to the i-th sub-triangular matrix to obtain the solution for the unknown corresponding to the i-th sub-triangular matrix.

[0091] By employing the above method, without altering the basic flow of the TRSM algorithm, the solution for the unknowns corresponding to each sub-triangular matrix can be directly obtained through matrix multiplication. The sub-constant matrix corresponding to the next sub-triangular matrix is ​​then updated based on the solved solutions, and the solution for the unknowns corresponding to the next sub-triangular matrix is ​​obtained. Thus, iterative methods are unnecessary in solving the unknowns for each sub-triangular matrix, thereby improving computational efficiency.

[0092] In addition, based on the partitioning method of multiple sub-triangular matrices, the target constant matrix can be divided into multiple sub-constant matrices to obtain multiple sub-constant matrices corresponding to the multiple sub-triangular matrices. The implementation method is as follows: when the total number of elements at the diagonal position of each sub-triangular matrix is ​​n, the target constant matrix is ​​partitioned according to the method of forming a sub-constant matrix with elements in every n rows, thus obtaining multiple sub-constant matrices.

[0093] For example, if n is 16, then for the target constant matrix, the matrix formed by the elements of rows 1 to 16 is called a sub-constant matrix, the matrix formed by the elements of rows 17 to 32 is called a sub-constant matrix, and so on, until the target constant matrix is ​​completely divided.

[0094] It should be noted that, since the embodiments of this application do not limit the partitioning method of the sub-triangular matrix, the partitioning method of the sub-constant matrix is ​​also not limited.

[0095] Furthermore, the multiple sub-triangular matrices are arranged in order according to their column positions in the target coefficient matrix. The specific sorting method depends on the type of the target coefficient matrix. For example, suppose the multiple sub-triangular matrices include a second sub-triangular matrix and a fourth sub-triangular matrix, and the second sub-triangular matrix is ​​positioned earlier in the column of the target coefficient matrix than the third sub-triangular matrix.

[0096] If the target coefficient matrix is ​​a lower triangular matrix, then the order of the second sub-triangular matrix is ​​before the order of the third sub-triangular matrix.

[0097] For example, if m is 256 and n is 16, then the first sub-triangle matrix after sorting is the top-left sub-triangle matrix of the target coefficient matrix, and the last sub-triangle matrix after sorting is the bottom-right sub-triangle matrix of the target coefficient matrix. The solution for the unknowns corresponding to the first sub-triangle matrix includes: x1 to x 16 The solution. The solution for the unknowns corresponding to the second sub-triangular matrix includes: x 17 To x 32 The solution. And so on, the solutions for the unknowns corresponding to the last sub-triangular matrix include: x 241 To x256 The solution.

[0098] Accordingly, when the target coefficient matrix is ​​an upper triangular matrix, the order of the second sub-triangular matrix is ​​placed after the order of the third sub-triangular matrix.

[0099] For example, if m is 256 and n is 16, then the first sub-triangle matrix after sorting is the first sub-triangle matrix in the bottom right corner of the target coefficient matrix, and the last sub-triangle matrix after sorting is the last sub-triangle matrix in the top left corner of the target coefficient matrix. The solution for the unknowns corresponding to the first sub-triangle matrix includes: x 241 To x 256 The solution. The solution for the unknowns corresponding to the second sub-triangular matrix includes: x 227 To x 242 The solution. Similarly, the solutions for the unknowns corresponding to the last sub-triangular matrix include: x1 to x... 16 The solution.

[0100] Figure 5 is a comparative schematic diagram of a scheme provided in an embodiment of this application. As shown in Figure 5, in the TRSM algorithm, when solving for the unknowns corresponding to each sub-triangular matrix, it is necessary to use an iterative method (i.e., solve calculation). In this process, the target constant matrix B corresponding to the target triangular matrix needs to be frequently called for calculation, resulting in low computational efficiency.

[0101] However, in the solution provided in this application embodiment, the inverse matrix of each sub-triangular matrix is ​​pre-calculated. Since the size of the sub-triangular matrices is small, this process can be implemented using a simple matrix inversion algorithm, and this process does not require calling the target constant matrix B corresponding to the target triangular matrix. After obtaining the inverse matrix of each sub-triangular matrix, the subsequent solution for the unknowns corresponding to each sub-triangular matrix can be achieved using a simple general matrix multiplication (GEMM) algorithm, without introducing an iterative solution process again. Therefore, the matrix computation unit can be used throughout to accelerate the process, fully utilizing the computational power of the matrix computation unit and thus improving computational efficiency.

[0102] Through the above comparison, the solution provided in this application can decouple the calculation process of the TRSM algorithm and determine the necessary information for the solve calculation process in advance (i.e., the inverse matrix of each sub-triangle matrix), thereby avoiding the problems of low efficiency and repetitive calculations in the TRSM algorithm. Furthermore, since only the inverse calculation of the sub-triangle matrices is performed, it also solves the problem of high global inversion overhead when using the TRMM algorithm.

[0103] In addition to the above, the solutions provided in this application also have the following advantages:

[0104] 1) Solving for the inverse of each subtriangular matrix has low overhead and is therefore easy to develop.

[0105] 2) Since solving the inverse matrix of each sub-triangular matrix depends only on the target coefficient matrix A itself, the information of the target constant matrix B is not needed and can be solved in advance. At the same time, since there is no dependency relationship in solving the inverse matrix of multiple sub-triangular matrices, the inversion process can be completely parallelized without any dependency restrictions.

[0106] 3) The inverse matrix of the sub-triangular matrix is ​​still a triangular matrix, so no additional space is required. Without needing to revisit the target coefficient matrix A, after obtaining the inverse matrix of each sub-triangular matrix, the inverse matrix of the sub-triangular matrix can be stored at the storage location of the corresponding sub-triangular matrix without occupying additional storage space.

[0107] The proportion of time saved by the data processing method provided in this application embodiment compared to the TRSM algorithm can be determined by the following formula:

[0108] In the above formula, n is the total number of columns in the target constant matrix, n0 is the number of columns corresponding to the target constant matrix in the TRSM algorithm, and τ solve τ represents the time required for the solve process in the TRSM algorithm. gemm τ represents the time required for the matrix multiplication algorithm in this embodiment. inv This represents the time required for the matrix inversion algorithm in the embodiments of this application.

[0109] In the TRSM algorithm, the target constant matrix needs to be divided by columns. For example, if the target constant matrix has 4 columns, it is divided into 4 parts, with each column representing a part. Then, each time the solution is performed, it is calculated based on one of the divided target constant matrices. However, in this embodiment, since it is not necessary to solve the problem through iterative methods but directly through matrix multiplication, it is not necessary to divide the target constant matrix by columns.

[0110] Based on the above formula, the method provided in this application embodiment can save time compared to the TRSM algorithm in the step of solving the unknowns corresponding to the sub-triangular matrices when solving a system of triangular matrix equations.

[0111] In summary, in the data processing method provided in this application embodiment, after obtaining the target coefficient matrix and target constant matrix corresponding to the target triangular matrix equation system to be solved, the inverse matrix of each sub-triangular matrix among the multiple sub-triangular matrices included in the target coefficient matrix is ​​determined by a matrix inversion algorithm. Subsequently, the solution to the target triangular matrix equation system can be directly determined by a matrix multiplication algorithm based on the inverse matrix of each sub-triangular matrix and the target constant matrix. This scheme is not only applicable to scenarios with large coefficient matrices, but also the entire solution process can be implemented entirely through matrix operations, thus improving the efficiency of solving the target triangular matrix equation system and thereby enhancing the processor's computing power.

[0112] Figure 6 is a schematic diagram of a data processing device provided in an embodiment of this application. As shown in Figure 6, the device 600 includes the following modules.

[0113] The acquisition module 601 is used to acquire the target coefficient matrix and target constant matrix corresponding to the target triangular matrix equation system; the specific implementation method can be referred to step 401 in the embodiment of Figure 4.

[0114] The first determining module 602 is used to determine the inverse matrix of each of the multiple sub-triangular matrices included in the target coefficient matrix through a matrix inversion algorithm, wherein the element at the diagonal position of each sub-triangular matrix is ​​the element at the diagonal position of the target coefficient matrix; for specific implementation, please refer to step 402 in the embodiment of Figure 4.

[0115] The second determining module 603 is used to determine the solution of the target triangular matrix equation system by matrix multiplication based on the inverse matrix of each sub-triangular matrix and the target constant matrix. For a specific implementation, please refer to step 403 in the embodiment shown in Figure 4.

[0116] In some embodiments, the total number of elements at the diagonal positions of each sub-triangular matrix is ​​n, where n is greater than 1 and less than m, and m is the number of rows in the target coefficient matrix.

[0117] In some embodiments, the plurality of sub-triangular matrices includes a first sub-triangular matrix; in this scenario, the first determining module is used to:

[0118] Construct a system of equations for the first sub-triangular matrix corresponding to the first sub-triangular matrix. The first sub-triangular matrix is ​​the coefficient matrix of the system of equations for the first sub-triangular matrix, and the constant matrix of the system of equations for the first sub-triangular matrix is ​​the identity matrix.

[0119] Solve the system of equations for the first subtriangular matrix, and use the solution of the system of equations for the first subtriangular matrix as the inverse matrix of the first subtriangular matrix.

[0120] In some embodiments, the second determining module is used to:

[0121] Based on the partitioning method of multiple sub-triangular matrices, the target constant matrix is ​​divided into multiple sub-constant matrices, resulting in multiple sub-constant matrices corresponding to the multiple sub-triangular matrices respectively. The number of rows in each sub-constant matrix is ​​the same as the number of columns in the corresponding sub-triangular matrix.

[0122] Arrange the multiple sub-triangular matrices in order according to their column positions in the target coefficient matrix, and multiply the inverse of the first sorted sub-triangular matrix with the corresponding sub-constant matrix to obtain the solution for the unknown corresponding to the first sub-triangular matrix.

[0123] For the sorted i-th sub-triangular matrix (i > 1), update the sub-constant matrix corresponding to the i-th sub-triangular matrix based on the solutions to the unknowns corresponding to the i-th (i-1)-th sub-triangular matrices. Then multiply the inverse matrix of the i-th sub-triangular matrix with the updated sub-constant matrix corresponding to the i-th sub-triangular matrix to obtain the solution to the unknowns corresponding to the i-th sub-triangular matrix.

[0124] In some embodiments, the plurality of sub-triangular matrices include a second sub-triangular matrix and a fourth sub-triangular matrix, and the column position of the second sub-triangular matrix in the target coefficient matrix is ​​earlier than the column position of the third sub-triangular matrix in the target coefficient matrix;

[0125] When the target coefficient matrix is ​​a lower triangular matrix, the second sub-triangular matrix is ​​ordered before the third sub-triangular matrix; or, when the target coefficient matrix is ​​an upper triangular matrix, the second sub-triangular matrix is ​​ordered after the third sub-triangular matrix.

[0126] In summary, in the data processing method provided in this application embodiment, after obtaining the target coefficient matrix and target constant matrix corresponding to the target triangular matrix equation system to be solved, the inverse matrix of each sub-triangular matrix among the multiple sub-triangular matrices included in the target coefficient matrix is ​​determined by a matrix inversion algorithm. Subsequently, the solution to the target triangular matrix equation system can be directly determined by a matrix multiplication algorithm based on the inverse matrix of each sub-triangular matrix and the target constant matrix. This scheme is not only applicable to scenarios with large coefficient matrices, but also the entire solution process can be implemented entirely through matrix operations, thus improving the efficiency of solving the target triangular matrix equation system and thereby enhancing the processor's computing power.

[0127] It should be noted that the data processing device provided in the above embodiments is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the data processing device and the data processing method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process can be found in the method embodiments, which will not be repeated here.

[0128] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., digital versatile discs (DVDs)), or semiconductor media (e.g., solid-state disks (SSDs)).

[0129] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.

[0130] The above content is not intended to limit the embodiments of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the embodiments of this application should be included within the protection scope of the embodiments of this application.

Claims

1. A data processing method, characterized in that, The method includes: Obtain the target coefficient matrix and target constant matrix corresponding to the target triangular matrix equation system; The inverse matrix of each of the multiple sub-triangular matrices included in the target coefficient matrix is ​​determined by a matrix inversion algorithm, and the element at the diagonal position of each sub-triangular matrix is ​​the element at the diagonal position of the target coefficient matrix. The solution to the system of equations for the target triangular matrix is ​​determined by matrix multiplication using the inverse matrix of each of the multiple sub-triangular matrices and the target constant matrix.

2. The method as described in claim 1, characterized in that, The total number of elements at the diagonal positions of each sub-triangular matrix is ​​n, where n is greater than 1 and less than m, and m is the number of rows in the target coefficient matrix.

3. The method as described in claim 1 or 2, characterized in that, The plurality of sub-triangular matrices includes a first sub-triangular matrix; The step of determining the inverse matrix of each of the multiple sub-triangular matrices included in the target coefficient matrix using a matrix inversion algorithm includes: Construct a system of equations for the first sub-triangular matrix corresponding to the first sub-triangular matrix, wherein the first sub-triangular matrix is ​​the coefficient matrix corresponding to the system of equations for the first sub-triangular matrix, and the constant matrix corresponding to the system of equations for the first sub-triangular matrix is ​​the identity matrix. Solve the system of equations for the first sub-triangular matrix, and use the solution of the system of equations for the first sub-triangular matrix as the inverse matrix of the first sub-triangular matrix.

4. The method according to any one of claims 1-3, characterized in that, The step of determining the solution to the triangular matrix equation system using a matrix multiplication algorithm based on the inverse matrix of each of the multiple sub-triangular matrices and the target constant matrix includes: Based on the partitioning method of the multiple sub-triangular matrices, the target constant matrix is ​​divided into multiple sub-constant matrices, resulting in multiple sub-constant matrices corresponding to the multiple sub-triangular matrices respectively, wherein the number of rows of each sub-constant matrix is ​​the same as the number of columns of the corresponding sub-triangular matrix; The multiple sub-triangular matrices are arranged in order according to their column positions in the target coefficient matrix, and the inverse of the first sorted sub-triangular matrix is ​​multiplied by the corresponding sub-constant matrix to obtain the solution of the unknown corresponding to the first sub-triangular matrix. For the sorted i-th sub-triangular matrix, where i is greater than 1, the sub-constant matrix corresponding to the i-th sub-triangular matrix is ​​updated based on the solution of the unknown corresponding to the 1st sub-triangular matrix to the solution of the unknown corresponding to the (i-1)th sub-triangular matrix. The inverse matrix of the i-th sub-triangular matrix is ​​then multiplied by the updated sub-constant matrix corresponding to the i-th sub-triangular matrix to obtain the solution of the unknown corresponding to the i-th sub-triangular matrix.

5. The method as described in claim 4, characterized in that, The plurality of sub-triangular matrices include a second sub-triangular matrix and a fourth sub-triangular matrix, wherein the column position of the second sub-triangular matrix in the target coefficient matrix is ​​earlier than the column position of the third sub-triangular matrix in the target coefficient matrix; When the target coefficient matrix is ​​a lower triangular matrix, the second sub-triangular matrix is ​​ordered before the third sub-triangular matrix; or, When the target coefficient matrix is ​​an upper triangular matrix, the order of the second sub-triangular matrix is ​​after the order of the third sub-triangular matrix.

6. A data processing apparatus, characterized in that, The data processing device includes: The acquisition module is used to acquire the target coefficient matrix and target constant matrix corresponding to the target triangular matrix equation system; The first determining module is used to determine the inverse matrix of each of the multiple sub-triangular matrices included in the target coefficient matrix by using a matrix inversion algorithm, wherein the element at the diagonal position of each sub-triangular matrix is ​​the element at the diagonal position of the target coefficient matrix. The second determining module is used to determine the solution of the target triangular matrix equation system by matrix multiplication algorithm based on the inverse matrix of each of the multiple sub-triangular matrices and the target constant matrix.

7. The apparatus as claimed in claim 6, characterized in that, The total number of elements at the diagonal positions of each sub-triangular matrix is ​​n, where n is greater than 1 and less than m, and m is the number of rows in the target coefficient matrix.

8. The apparatus as claimed in claim 6 or 7, characterized in that, The second determining module is used for: Based on the partitioning method of the multiple sub-triangular matrices, the target constant matrix is ​​divided into multiple sub-constant matrices, resulting in multiple sub-constant matrices corresponding to the multiple sub-triangular matrices respectively, wherein the number of rows of each sub-constant matrix is ​​the same as the number of columns of the corresponding sub-triangular matrix; The multiple sub-triangular matrices are arranged in order according to their column positions in the target coefficient matrix, and the inverse of the first sorted sub-triangular matrix is ​​multiplied by the corresponding sub-constant matrix to obtain the solution of the unknown corresponding to the first sub-triangular matrix. For the sorted i-th sub-triangular matrix, where i is greater than 1, the sub-constant matrix corresponding to the i-th sub-triangular matrix is ​​updated based on the solution of the unknown corresponding to the 1st sub-triangular matrix to the solution of the unknown corresponding to the (i-1)th sub-triangular matrix. The inverse matrix of the i-th sub-triangular matrix is ​​then multiplied by the updated sub-constant matrix corresponding to the i-th sub-triangular matrix to obtain the solution of the unknown corresponding to the i-th sub-triangular matrix.

9. A computer device, characterized in that, The computer device includes a processor and memory; The processor of the computer device is used to execute instructions stored in the memory of the computer device to cause the cluster of computer devices to perform the method as described in any one of claims 1-5.

10. A computer program product containing instructions, characterized in that, When the instructions are executed by a computer device, the computer device performs the method as described in any one of claims 1-5.