Adaptive matching model of matrix power algorithm based on decision tree

By constructing an adaptive matching model for matrix exponentiation based on decision trees, the optimal algorithm is automatically selected, solving the problems of low efficiency and inconsistent results in matrix exponentiation calculation caused by manual experience-based selection, and achieving efficient and reliable matrix exponentiation solutions.

CN123138555APending Publication Date: 2026-11-20WUHAN UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611144499.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-30
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

In existing technologies, the selection of matrix exponentiation algorithms relies on human experience, resulting in low computational efficiency, inconsistent results, and difficulty in adapting to changes in matrix type. There is a lack of systematic and automated selection schemes.

Method used

An adaptive matching model for matrix power algorithms based on decision trees is constructed. By obtaining the algebraic property parameters of the matrix, the optimal algorithm is automatically matched using CART decision trees, including matrix diagonalization, spectral decomposition, zero-power decomposition, rank decomposition, Jordan canonical form method, and minimum polynomial power reduction method. The decision tree is optimized using information gain ratio and cost complexity pruning strategies.

Benefits of technology

It achieves automatic optimal matching of matrix exponentiation algorithm, reduces computational complexity, ensures consistency and reliability, is applicable to various matrix types, adapts to actual numerical calculation scenarios, and has good anti-interference ability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123138555A_ABST
    Figure CN123138555A_ABST
Patent Text Reader

Abstract

The application discloses a matrix power algorithm adaptive matching model based on a decision tree, and belongs to the technical field of linear algebra calculation and algorithm selection. The method obtains algebraic property parameters of a matrix to be solved, including diagonalizability, rank, normality, order and nilpotent separability; the parameters are used as judgment predicates, six algorithms, including a matrix diagonalization method, a spectral decomposition method, a nilpotent decomposition method, a rank decomposition method, a Jordan standard form method and a minimum polynomial power reduction method, are used as output categories, and a CART decision tree model is constructed; a root node is "whether diagonalizable", and the matrix is guided to a unique optimal algorithm through low rank, normality, high order and nilpotent decomposition judgment in sequence; information gain ratio is used as a split criterion, and zero error is used as a constraint to perform cost complexity pruning optimization. The application realizes automatic and zero error matching of the matrix power algorithm, avoids subjectivity and mismatching risk of manual selection, and is suitable for numerical calculation scenes related to matrix power operation, such as difference equations and Markov chains.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of algorithms, and specifically to an adaptive matching model based on a matrix exponentiation algorithm using decision trees. Background Technology

[0002] Matrix exponentiation is a core fundamental problem in linear algebra theory, widely applied in various fields such as solving difference equations, calculating state transition probabilities in Markov chains, analyzing discrete control systems, numerical computation, and engineering practice. In control theory, the exponentiation of state transition matrices plays a crucial role in predicting the state of a system at a specific future time. In finance, matrix exponentiation is used to simulate the random walk process of asset prices. Therefore, efficient and accurate solutions for matrix exponentiation have significant theoretical and practical value.

[0003] Currently, the academic community has developed various methods for solving matrix powers, mainly including: mathematical induction, nilpotent decomposition, associative multiplication law, characteristic polynomial and non-homogeneous linear equation system method, square zero matrix auxiliary decomposition method, matrix diagonalization, spectral decomposition, rank decomposition, Jordan canonical form method, and power reduction method based on minimum polynomial. Each of these methods has its applicable matrix types and limitations. For example, matrix diagonalization is computationally efficient and yields intuitive results, but it is only applicable to diagonalizable square matrices; Jordan canonical form holds true for any square matrix in the complex field and is theoretically complete, but its computation is cumbersome and requires solving for the generalized eigenvectors and the inverse of the transformation matrix; rank decomposition has a dimensionality reduction advantage for reduced-rank square matrices, but it is only effective for reduced-rank square matrices; nilpotent decomposition is computationally extremely simple but only applicable to special square matrices where all main diagonal elements are equal and can be decomposed into nilpotent matrices. A single algorithm cannot meet the needs of efficient solution for all matrix types. Selecting the appropriate solution method for different types of matrices is the key to reducing computational complexity and improving solution efficiency.

[0004] However, the current selection of matrix exponentiation algorithms mainly relies on manual experience—operators must choose a suitable algorithm from multiple options based on algebraic properties such as diagonalizability, rank, normality, order, and nilpotent decomposability of the matrix. This manual selection method has significant drawbacks: first, it requires a high level of professional knowledge from the operator, and differences in experience among different personnel lead to inconsistent selection quality; second, for matrices with complex structures, manual judgment is prone to mismatches, resulting in low computational efficiency or even inapplicability of the method; third, when the matrix size increases or its type changes, manual selection lacks a standardized decision-making process, making it difficult to ensure consistency and optimality of the selection. Existing research has pointed out that different operation methods should be used for different types of matrices, and "choosing a good method can simplify the calculation," but how to systematically and automatically complete this selection process currently lacks an effective solution.

[0005] To address the aforementioned issues, the applicant proposes an adaptive matching model based on a matrix exponentiation algorithm using decision trees. Summary of the Invention

[0006] The purpose of this invention is to provide an adaptive matching model based on a matrix exponentiation algorithm using decision trees, in order to solve the problems in the prior art.

[0007] To achieve the above objectives, the present invention provides the following technical solution: an adaptive matching model based on a matrix exponentiation algorithm using a decision tree, comprising the following steps:

[0008] Step S1: Obtain the algebraic property parameters of the n-order square matrix A to which the power of the matrix to be solved is obtained. The algebraic property parameters include at least: diagonalizability, matrix rank, normality, matrix order, and powerless decomposability.

[0009] Step S2: Construct an algorithm matching model based on CART decision tree, using the algebraic property parameters obtained in step S1 as the decision predicate, and using six matrix power solving algorithms—matrix diagonalization, spectral decomposition, zero-power decomposition, rank decomposition, Jordan canonical form, and minimum polynomial power reduction—as the output categories.

[0010] Step S3: Using "whether the matrix is ​​diagonalizable" as the basis for splitting the root node, divide all n-order square matrices into diagonalizable branches and non-diagonalizable branches;

[0011] Step S4: In the diagonalizable branch, perform the following checks in sequence:

[0012] Sub-step S41: Determine if the matrix is ​​a low-rank matrix; if so, use the matching rank decomposition method.

[0013] Sub-step S42: If the matrix is ​​not low rank, determine whether the matrix is ​​a normal matrix. If it is, use the matching spectral decomposition method; otherwise, use the matching matrix diagonalization method.

[0014] Step S5: In the non-diagonalizable branch, perform the following checks in sequence:

[0015] Sub-step S51: Determine if the matrix is ​​a high-order matrix. If so, match the minimum polynomial power reduction method.

[0016] Sub-step S52: If the matrix is ​​not of higher order, determine whether the matrix is ​​idempotent. If it is, match the idempotent decomposition method; otherwise, match the Jordan canonical form method.

[0017] Step S6: Using the information gain ratio as the node splitting criterion, calculate the splitting gain of each decision predicate, select the predicate with the largest gain as the basis for node splitting, and recursively generate a decision tree until all branches converge to a unique algorithm output.

[0018] Step S7: Use a cost complexity pruning strategy to prune and optimize the decision tree. With zero matching error as the constraint and minimizing the depth of the decision tree as the objective, the ratio of node splitting gain to depth is used as the importance metric. Select the node with the lowest importance as a pruning candidate. If the matching error is zero after replacing the candidate node with a leaf node, then its subtree is pruned. Iterate until there are no more nodes to prune to obtain the optimal decision tree.

[0019] Step S8: Input the algebraic property parameters of the matrix to be solved into the optimal decision tree, and output the optimal matrix exponentiation algorithm that uniquely matches the matrix.

[0020] Optionally, the determination condition for the low-rank matrix in step S4 is: rank(A) ≤ ε·n, where ε is an adjustable low-rank determination threshold, ε = 0.1, and n is the matrix order.

[0021] Optionally, the determination condition for the higher-order matrix in step S5 is: matrix order n > N0, where N0 is an adjustable higher-order threshold.

[0022] Optionally, the information gain ratio in step S6 can be calculated as follows: using node purity as the core metric, calculate the information gain ratio of each decision predicate, and select the predicate with the largest gain and the lowest decision complexity as the basis for node splitting.

[0023] Optionally, the iteration termination condition of the cost complexity pruning strategy described in step S7 is: the matching error of all leaf nodes is zero, and there are no nodes whose structure can be further simplified through pruning.

[0024] Optionally, each of the six matrix exponentiation algorithms has the following applicable conditions:

[0025] Matrix diagonalization is applicable to diagonalizable, non-low-rank, and non-normal n-order square matrices.

[0026] Spectral decomposition is applicable to diagonalizable normal matrices;

[0027] The nullification method is applicable to low-order square matrices that are not diagonalizable and can be decomposed into the sum of a scalar matrix and a nullification matrix.

[0028] Rank decomposition is applicable to diagonalizable low-rank square matrices;

[0029] Jordan's standard form method is applicable to square matrices that are not diagonalizable and cannot be decomposed into zero-power factors;

[0030] The least polynomial power reduction method is applicable to high-order square matrices that cannot be diagonalized.

[0031] Optionally, the optimal decision tree described in step S8 is complete for all n-order square matrices: with "whether it is diagonalizable" as the root node, all n-order square matrices are divided into two major categories: diagonalizable and non-diagonalizable. The two categories have no overlap and are fully covered. Each internal node is subdivided layer by layer, and all matrices eventually fall into a unique leaf node and are matched with a unique algorithm.

[0032] Optionally, the model verification step is also included: multi-dimensional verification of the model through theoretical verification, typical matrix instance verification, numerical comparison verification, and robustness verification; the theoretical verification verifies the completeness, logical correctness, uniqueness, and optimality of the model; the numerical comparison verification compares the mismatch rate, selection time, and computational complexity of automatic model selection and manual experience selection by randomly generating multiple sets of n-order square matrices of different types; the robustness verification verifies whether the matching algorithm remains unchanged by applying a small numerical perturbation to the matrix and then resubmitting it into the model for judgment.

[0033] Optionally, the space complexity of the model is O(n), and the matching time complexity is comparable to the computational complexity of a single matrix exponentiation algorithm.

[0034] Optionally, the method is applicable to scenarios involving matrix exponentiation in solving difference equations, calculating state transition probabilities of Markov chains, and analyzing discrete control systems.

[0035] Beneficial effects: 1. Enables automatic optimal matching of matrix exponentiation algorithm, effectively overcoming the shortcomings of manual selection.

[0036] This invention constructs a complete decision tree matching model using algebraic properties such as matrix diagonalizability, rank, normality, order, and nullification as judgment predicates. It incorporates six matrix power-law algorithms (diagonalization, spectral decomposition, nullification, rank decomposition, Jordan canonical form, and minimum polynomial power reduction) into a unified automatic selection framework. Compared to traditional manual selection based on experience, this invention eliminates the need for operators to possess deep professional knowledge, avoiding inconsistent selection quality due to differences in experience. It also eliminates the subjectivity and randomness of manual judgment, ensuring consistency and reproducibility of selection results across different operators and scenarios. Numerical experiments show that the mismatch rate of this method can be reduced to 0%, significantly better than the approximately 18% mismatch rate of manual selection, effectively solving the technical problem of easy mismatch in manual selection, and is particularly suitable for scenarios where personnel lack experience in matrix calculations.

[0037] 2. Reduce computational complexity and improve the efficiency of matrix exponentiation.

[0038] This invention utilizes a hierarchical decision tree structure to guide a matrix to a unique optimal algorithm within a finite number of steps, avoiding computational redundancy caused by exhaustive attempts or blindly selecting general algorithms. Specifically: for diagonalizable matrices, the model prioritizes matching the most computationally efficient diagonalization method or spectral decomposition method; for reduced-rank matrices, it matches the rank decomposition method, which has dimensionality reduction advantages, transforming the calculation of n-order matrix exponentiation into r-order (r is the rank) low-order matrix exponentiation; for non-diagonalizable matrices, depending on whether they are high-order or can be decomposed into zero, it matches the minimum polynomial exponentiation method or the zero-power decomposition method, avoiding the direct use of the most computationally intensive Jordan canonical form method. This strategy ensures that each type of matrix matches the solution with the lowest computational complexity under the current applicable conditions, and the matching time complexity of the model in this invention is comparable to the computational complexity of a single matrix exponentiation algorithm, without adding extra computational burden, thus significantly reducing the overall computational overhead of matrix exponentiation.

[0039] 3. The decision-making structure is simple, the decision path is clear, and the computational cost is low.

[0040] This invention employs a CART binary decision tree structure, with "diagonalizability" as the root node. Subsequent checks only require determining low-rank, normality, higher-order, and decomposability, completing the algorithm matching in a maximum of four checks. The decision path is short, the logic is concise and rigorous, and complex iterative calculations or large-scale data processing are unnecessary. Furthermore, this invention uses the information gain ratio as the node splitting criterion, selecting the predicate with the highest gain and lowest decision complexity as the basis for node splitting, ensuring a compact decision tree structure and efficient decision-making. A cost complexity pruning (CCP) strategy is introduced, reducing the decision tree depth to the minimum value that satisfies matching correctness with zero error as a constraint, further simplifying the tree structure and reducing the computational complexity of decision-making. The space complexity of this invention is O(n), exhibiting low resource consumption and adapting to resource-constrained computing environments.

[0041] 4. High matching accuracy and zero-error constraints ensure reliable selection.

[0042] This invention uses zero-error algorithm matching as the core constraint for pruning optimization, ensuring that the pruned decision tree simplifies the structure without sacrificing any matching correctness. Theoretical verification demonstrates that this invention possesses completeness (all matrix types have corresponding algorithm paths, with no omissions), logical correctness (each node's decision strictly adheres to the mathematical properties of the six algorithms, with no logical conflicts), uniqueness (each matrix corresponds to a unique decision path and a unique algorithm output), and optimality (each step prioritizes the algorithm with stronger applicability and lower complexity), mathematically guaranteeing the accuracy and reliability of the selection. Numerical verification shows a 0% mismatch rate for 50 sets of random matrices, fully demonstrating the high reliability of this invention.

[0043] 5. It exhibits good robustness and is adaptable to real-world numerical computation scenarios.

[0044] This invention uses the qualitative algebraic properties of matrices (whether they are diagonalizable, low-rank, normal, and decomposed into zero-idempotent values) as the criteria for judgment. These properties provide inherent stability against minute numerical perturbations to matrix elements. In actual numerical calculations, matrix elements often experience minor deviations due to rounding errors, measurement errors, or floating-point arithmetic precision, which may cause slight fluctuations in numerical parameters such as eigenvalues, but will not change the core algebraic properties of the matrix, such as diagonalizability and the qualitative state of its rank. Experiments show that even after applying minute perturbations such as ±0.001 eigenvalue offsets, ±0.001 fluctuations in matrix elements, and critical changes in rank, the decision path and final matching algorithm of this invention remain unchanged, demonstrating good anti-interference capabilities and adaptability to numerical error scenarios in practical engineering applications.

[0045] 6. Highly interpretable, facilitating engineering deployment and widespread application.

[0046] Unlike traditional "black box" machine learning models, the decision tree model constructed in this invention possesses inherent transparency and interpretability—each decision path can be fully traced through "yes / no" logic, allowing users to clearly understand why a particular matrix is ​​matched to a specific algorithm. This characteristic enables this invention not only to serve as an automated selection tool but also as a teaching aid, helping users deeply understand the applicable conditions and selection logic of different matrix exponentiation algorithms. Furthermore, the decision tree structure is easily converted into rule sets or flowcharts, and can be directly embedded into scientific computing tools such as MATLAB and Python for automated solution, resulting in low engineering deployment barriers and strong adaptability.

[0047] 7. Wide range of applications, covering various matrices and multiple fields of scenarios.

[0048] This invention is applicable to the selection of matrix exponentiation algorithms for all n-order square matrices, covering all types including diagonalizable matrices, non-diagonalizable matrices, reduced-rank matrices, full-rank matrices, normal matrices, non-normal matrices, low-order matrices, and high-order matrices, breaking through the limitation of single algorithms being applicable only to specific matrix types. Furthermore, this invention can be directly applied to various practical scenarios involving matrix exponentiation operations, such as solving difference equations, calculating multi-step transition probabilities of Markov chains, state transition analysis of discrete control systems, iterative solutions in numerical linear algebra, and matrix function approximation in engineering, demonstrating its broad application value. Attached Figure Description

[0049] Figure 1 This is a schematic diagram of the structure of an embodiment of the present invention. Detailed Implementation

[0050] The preferred embodiments of the present invention are described below with reference to the accompanying drawings to make the technical content clearer and easier to understand. The present invention can be embodied in many different forms, and the scope of protection of the present invention is not limited to the embodiments mentioned herein.

[0051] This invention provides an adaptive matching model based on a matrix exponentiation algorithm using a decision tree. The invention will be further described in detail below with reference to specific embodiments.

[0052] The core of this invention lies in utilizing the CART decision tree model, with the algebraic properties of the matrix as the decision predicate, to achieve automatic, unique, and zero-error optimal matching among six matrix exponentiation algorithms. The entire implementation process includes four main stages: construction of the decision tree model, determination of node splitting criteria, pruning and optimization of the decision tree, and multi-dimensional verification of the model.

[0053] In the decision tree model construction phase, the first step is to determine the model's input features and output categories. The input features are the algebraic properties of the n-order square matrix A to which the power of a matrix is ​​to be calculated. Specifically, these include: whether the matrix is ​​diagonalizable, its rank (rank(A)), whether it is a normal matrix, its order n, and whether it can be decomposed into zero powers. These five features comprehensively characterize the matrix's structural properties and effectively distinguish the applicable conditions of the six matrix power-solving algorithms. The output categories are the six matrix power-solving algorithms: matrix diagonalization, spectral decomposition, zero powers, rank decomposition, Jordan canonical form, and minimum polynomial power reduction. These six algorithms cover all solution scenarios, from diagonalizable to non-diagonalizable matrices, from full-rank to reduced-rank matrices, and from low-order to high-order matrices.

[0054] The decision tree adopts the classic structure of a CART binary tree, using "diagonalizability" as the splitting criterion for the root node. The reason for choosing diagonalizability as the splitting feature for the root node is that diagonalizability is the most fundamental algebraic property that distinguishes matrix exponentiation algorithms. Diagonalizable matrices and non-diagonalizable matrices have fundamentally different solution methods—the former can be directly transformed into diagonal matrix exponentiation through similar diagonalization, resulting in extremely high computational efficiency; the latter requires more general tools such as Jordan canonical form or minimal polynomials. The root node divides all n-order square matrices into two main categories: diagonalizable branches and non-diagonalizable branches. These two categories have no overlap and are fully covered, ensuring the completeness of the decision tree model.

[0055] In the diagonalizable branch, the model performs two levels of decision-making sequentially. The first level is the low-rank determination, with the condition rank(A) ≤ ε·n, where ε is an adjustable low-rank threshold (set to 0.1), and n is the matrix order. When the matrix satisfies the low-rank condition, the matching rank decomposition method is used. The rank decomposition method performs a full-rank decomposition of the square matrix A = GH (where G consists of column maximal linearly independent sets, and H is the coefficient matrix with these maximally linearly independent sets as its basis). Using the associative law of matrix multiplication and mathematical induction, it derives A^k = G(HG)^{k-1}H, reducing the calculation of the n-order reduced-rank square matrix power to an r-order (r = rank(A)) low-order matrix power operation, significantly reducing computational complexity. When the matrix does not satisfy the low-rank condition, it enters the second level of decision-making—normality determination. If the matrix is ​​a normal matrix (i.e., satisfying A^HA = AA^H, where A^H is the conjugate transpose), the matching spectral decomposition method is used; if the matrix is ​​not normal, the matching matrix diagonalization method is used. Spectral decomposition is suitable for normal matrices. Its advantage lies in the fact that the spectral projection matrix is ​​constructed from unit orthogonal eigenvectors, completely avoiding inversion operations and exhibiting strong numerical stability. Matrix diagonalization is suitable for general diagonalizable matrices, and its calculation formula is A^k = PΛ^kP^{-1}, where P is an invertible matrix composed of eigenvectors, and Λ is an eigenvalue diagonal matrix. This method has clear theory and high computational efficiency.

[0056] In the non-diagonalizable branch, the model also performs two levels of decision-making sequentially. The first level is the higher-order property decision, with the condition that the matrix order n > N0, where N0 is an adjustable higher-order threshold. When the matrix is ​​a higher-order matrix, the minimum polynomial power reduction method is used. The minimum polynomial power reduction method is based on the Cayley-Hamilton theorem and the property of the minimum polynomial: if m(λ) is the minimum polynomial of A with degree d, then for any positive integer k, A^k can be linearly expressed by I, A, A², ..., A^{d-1}, i.e., A^k = c0I + c1A + ... + c_{d-1}A^{d-1}, thus reducing the higher order to a combination of lower-order matrix polynomials, avoiding the complex generalized eigenvector solution and matrix inversion operations in the Jordan canonical form method. When the matrix does not satisfy the higher-order condition, the second level of decision-making—the null-power decomposability decision—is entered. If matrix A can be decomposed into the sum of a scalar matrix λI and a null-power matrix B, i.e., A = λI + B, where B^m = 0 (m is the null-power exponent), then by the binomial theorem, A^k = Σ_{i=0}^{m-1}C_k^i λ^{ki} B^i. Only the first m terms need to be retained to complete the solution, making the calculation extremely simple. If the matrix cannot be null-powered, then the Jordan canonical form method is used. The Jordan canonical form method is a general solution method for any square matrix in the complex field: for a square matrix A, there exists an invertible matrix P such that P^{-1}AP = J, where J is in Jordan canonical form and consists of several Jordan blocks J_s(λ), then A^k = PJ^kP^{-1}. This method is theoretically complete, yields unique results, and is applicable to all non-diagonalizable square matrices that cannot be null-powered.

[0057] In the above decision-making process, the splitting criterion for each node adopts the information gain ratio instead of the traditional information gain. Information gain tends to select features with more values ​​for splitting, while the decision predicates in this invention are all binary features (yes / no), with the same number of values. Although the bias of information gain is not significant, for the theoretical rigor of the model, the information gain ratio is still used as the splitting criterion. The information gain ratio is defined as Gain_ratio(D, a) = Gain(D, a) / IV(a), where Gain(D, a) is the information gain of feature a with respect to dataset D, and IV(a) is the splitting information (intrinsic information) of feature a, calculated by the formula IV(a) = -Σ_{v=1}^{V} (|D^v| / |D|) log2(|D^v| / |D|), where V is the number of values ​​of feature a. For binary features, IV(a) = -(p log2 p + (1-p) log2(1-p)), where p is the proportion of samples with the feature value "yes". During model implementation, the information gain ratio (IVR) of each candidate decision predicate is calculated, and the predicate with the largest IVR and lowest decision complexity is selected as the splitting criterion for the current node. This strategy ensures that the decision tree converges to a unique algorithm output with the fewest splitting steps, while avoiding redundancy in the decision path due to improper selection of splitting criteria.

[0058] The decision tree is generated recursively: starting from the root node, the matrix set is partitioned according to the optimal predicate mentioned above, and child nodes are generated. This process is repeated layer by layer until all branches correspond to the output of a single algorithm. Since both the matrix property determination and the algorithm set are finite in dimension, this recursive process can be completed in a finite number of steps, and the decision tree structure has inherent completeness and convergence.

[0059] After the decision tree is generated, the pruning optimization stage begins. This invention employs the Cost-Complexity Pruning (CCP) strategy, proposed by Breiman et al. in 1984, which is the standard pruning method for the CART algorithm. The core constraint of pruning is zero algorithm matching error—that is, the algorithm output by the pruned decision tree for any input matrix must be completely consistent with that before pruning, and no mismatch should occur due to pruning. The optimization objective of pruning is to minimize the depth of the decision tree, that is, to simplify the tree structure and reduce the computational complexity of decision-making as much as possible while ensuring the zero-error constraint.

[0060] The specific implementation steps of cost complexity pruning are as follows. First, the cost complexity function of the decision tree T is defined as R_α(T) = R(T) + α·|f(T)|, where R(T) is the training error of the tree (i.e., the matching error rate in this invention), |f(T)| is the number of leaf nodes in the tree, and α is a non-negative complexity parameter. For each internal node t in the tree, let T_t be the subtree rooted at t, R(t) is the error when t is directly used as a leaf node, R(T_t) is the error when the subtree T_t is retained, and |f(T_t)| is the number of leaf nodes in the subtree T_t. The effective complexity parameter of node t is defined as g(t) = [R(t) - R(T_t)] / (|f(T_t)| - 1), which measures the increase in error corresponding to the unit complexity reduction brought about by pruning the subtree rooted at t. The smaller the value of g(t), the smaller the impact of pruning the subtree on the error, and therefore the weakest link.

[0061] In each pruning iteration, the g(t) value of all internal nodes in the current tree is calculated, and the node with the smallest g(t) is selected as a pruning candidate. The candidate node is replaced with a leaf node (whose class label is the most common algorithm output in the set of matrices covered by that node). Then, it is verified whether the pruned decision tree still satisfies the zero-error constraint—that is, whether the matching results before and after pruning are completely consistent for all matrix types. If the zero-error constraint is satisfied, pruning is performed, deleting all child nodes of that node; if not, the node is skipped, and the node with the second smallest g(t) is selected as a candidate, and the verification process is repeated. After one round of iteration, the next round of pruning begins, until there are no more internal nodes to prune in the current tree, or all pruning candidates fail to satisfy the zero-error constraint. The decision tree obtained at this point is the optimal decision tree with the simplest structure and the highest decision efficiency.

[0062] During the pruning process, an important technical detail needs to be explained: the method for measuring node importance. This invention uses the ratio of node split gain to depth as a supplementary measure of node importance. Split gain reflects the degree of contribution of the node in distinguishing different matrix types and guiding different algorithms; depth reflects the node's position in the decision tree—the closer the node is to the root node, the greater its impact on the final result. Combining the two allows for a more comprehensive evaluation of the actual value of a node in the decision tree, avoiding the risk of mispruning that may result from pruning solely based on the g(t) value.

[0063] After pruning, the model validation phase begins. This invention comprehensively examines the model from four dimensions: theoretical validation, validation using typical matrix examples, numerical comparison validation, and robustness validation.

[0064] The theoretical verification includes four aspects of proof. First, the completeness proof: the decision tree uses "diagonalization" as the root node, dividing all n-order square matrices into two categories: diagonalizable and non-diagonalizable. These two categories have no overlap and are fully covered. Each internal node is further subdivided layer by layer, ensuring that all matrices ultimately fall into a unique leaf node and are matched with a unique algorithm; there are no unmatchable matrix types. Second, the logical correctness proof: the decision of each node strictly adheres to the mathematical applicability conditions of six algorithms—low rank corresponds to rank decomposition, normality corresponds to spectral decomposition, diagonalizability corresponds to matrix diagonalization, higher order corresponds to minimal polynomial power reduction, zero-power decomposition corresponds to zero-power decomposition, and the remaining cases correspond to Jordan canonical form—there are no logical conflicts in the decision paths, and the matching results conform to the basic theory of linear algebra. Third, the uniqueness proof: the core algebraic properties of a single matrix, such as diagonalizability, low rank, and normality, are deterministic, corresponding to a unique decision path. Therefore, the algorithm output by the model is unique, and the same matrix will not be simultaneously assigned to multiple leaf nodes. Fourth, the optimality is proven: at each step of the model, the algorithm with stronger applicability, lower computational complexity and better numerical stability is selected first. The final output leaf node can be regarded as the preferred solution under the current matrix type.

[0065] Typical matrix examples were used to verify the decision tree model. Six typical matrices were selected and substituted one by one. Example 1 is a third-order low-rank diagonalizable matrix (rank is 1), and the decision path is "diagonalizable → low-rank → rank decomposition method"; Example 2 is a third-order real symmetric normal matrix, and the decision path is "diagonalizable → non-low-rank → normal → spectral decomposition method"; Example 3 is a third-order ordinary diagonalizable nonnormal matrix, and the decision path is "diagonalizable → non-low-rank → nonnormal → diagonalization method"; Example 4 is a twelfth-order high-order non-diagonalizable matrix, and the decision path is "non-diagonalizable → high-order → minimum polynomial power reduction method"; Example 5 is a fourth-order idempotent zero-decomposition matrix, and the decision path is "non-diagonalizable → non-high-order → idempotent zero-decomposition → zero-power decomposition method"; Example 6 is a fourth-order general non-diagonalizable matrix, and the decision path is "non-diagonalizable → non-high-order → non-idempotent zero-decomposition → Jordan canonical form method". All instances were matched along the correct path, the verification process was reproducible, and there were no mismatches or ambiguities.

[0066] Numerical comparison and verification were conducted using two control experiments: the experimental group used the decision tree model of this invention for automatic selection, while the control group used manual selection based on experience. Fifty groups of different types of n-order square matrices (orders from 3 to 20) were randomly generated, and experiments were performed using MATLAB. The mismatch rate, selection time, and computational complexity were compared. Experimental results showed that the decision tree model had a mismatch rate of 0.0%, while the manual selection rate was 18.0%. The average selection time of the decision tree model was comparable to that of manual selection, but its solution complexity was significantly better. This demonstrates that this invention can effectively avoid algorithmic mismatches caused by insufficient human experience, while maintaining low selection time and superior solution complexity.

[0067] Robustness verification was conducted by applying small numerical perturbations to the six typical matrices described above to test the model's resistance to interference. Three types of perturbations were included: eigenvalue ±0.001 offset, matrix element ±0.001 fluctuation, and critical rank change. The perturbed matrices were then re-substituted into the decision tree model for judgment, and the matching algorithm was observed to see if it changed. Experimental results show that, under all perturbation scenarios, the core qualitative properties of the matrix, such as diagonalizability, low rank, and normality, remain unchanged, and the decision path and final matching algorithm are completely consistent with those before the perturbation. This is because the judgment criteria of this invention are based on the qualitative algebraic properties of the matrix rather than quantitative numerical values. These properties have inherent stability against small numerical perturbations of matrix elements—in actual numerical calculations, matrix elements often exhibit slight deviations due to rounding errors, measurement errors, or floating-point arithmetic precision, but these deviations do not change the core algebraic properties of the matrix, such as diagonalizability and rank. Experimental results demonstrate that this invention possesses good anti-interference capabilities in practical numerical calculation environments and is suitable for numerical error scenarios in practical engineering applications.

[0068] In terms of model application, this invention can be directly embedded into scientific computing software (such as MATLAB and Python) to achieve automated solution. Specifically, the implementation involves: writing automatic matrix algebraic property discrimination functions to implement modules for diagonalizability determination (by calculating the geometric and algebraic multiplicity of eigenvalues), low-rank determination (by singular value decomposition or rank decomposition), normality determination (by verifying AA^H = A^HA), and nilpotent decomposability determination (by verifying whether A - λI is a nilpotent matrix); encapsulating these discrimination functions and decision tree determination logic into a unified algorithm selection interface; after inputting any n-order square matrix, the interface automatically extracts algebraic property parameters, executes decision tree determination, and outputs the optimal algorithm name and corresponding solution code template. The entire selection process requires no manual intervention, achieving complete automation of matrix power algorithm selection.

[0069] The model of this invention has a space complexity of O(n), and its matching time complexity is comparable to that of a single matrix exponentiation algorithm, without adding any extra computational burden. The model is applicable to various practical scenarios involving matrix exponentiation operations, such as solving difference equations, calculating multi-step transition probabilities in Markov chains, analyzing state transitions in discrete control systems, iterative numerical linear algebra solutions, and matrix function approximation in engineering.

[0070] In summary, this invention provides a complete implementation scheme for an adaptive matching model based on a decision tree matrix exponentiation algorithm, covering the entire process of model construction, splitting criterion determination, pruning optimization, and multi-dimensional verification. This implementation scheme is logically clear, with standardized steps and strong operability, providing a practical technical path for the automatic optimal matching of matrix exponentiation algorithms.

[0071] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. It will be apparent to those skilled in the art that the invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered illustrative and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the scope of the invention. No reference numerals in the claims should be construed as limiting the scope of the claims.

[0072] Furthermore, it should be understood that although this specification describes embodiments, not every embodiment contains only one independent technical solution. This narrative style is merely for clarity. Those skilled in the art should consider the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.

Claims

1. An adaptive matching model based on a matrix exponentiation algorithm using decision trees, characterized in that, Includes the following steps: Step S1: Obtain the algebraic property parameters of the n-order square matrix A to which the power of the matrix to be solved is obtained. The algebraic property parameters include at least: diagonalizability, matrix rank, normality, matrix order, and powerless decomposability. Step S2: Construct an algorithm matching model based on CART decision tree, using the algebraic property parameters obtained in step S1 as the decision predicate, and using six matrix power solving algorithms—matrix diagonalization, spectral decomposition, zero-power decomposition, rank decomposition, Jordan canonical form, and minimum polynomial power reduction—as the output categories. Step S3: Using "whether the matrix is ​​diagonalizable" as the basis for splitting the root node, divide all n-order square matrices into diagonalizable branches and non-diagonalizable branches; Step S4: In the diagonalizable branch, perform the following checks in sequence: Sub-step S41: Determine if the matrix is ​​a low-rank matrix; if so, use the matching rank decomposition method. Sub-step S42: If the matrix is ​​not low rank, determine whether the matrix is ​​a normal matrix. If it is, use the matching spectral decomposition method; otherwise, use the matching matrix diagonalization method. Step S5: In the non-diagonalizable branch, perform the following checks in sequence: Sub-step S51: Determine if the matrix is ​​a high-order matrix. If so, match the minimum polynomial power reduction method. Sub-step S52: If the matrix is ​​not of higher order, determine whether the matrix is ​​idempotent. If it is, match the idempotent decomposition method; otherwise, match the Jordan canonical form method. Step S6: Using the information gain ratio as the node splitting criterion, calculate the splitting gain of each decision predicate, select the predicate with the largest gain as the basis for node splitting, and recursively generate a decision tree until all branches converge to a unique algorithm output. Step S7: Use a cost complexity pruning strategy to prune and optimize the decision tree. With zero matching error as the constraint and minimizing the depth of the decision tree as the objective, the ratio of node splitting gain to depth is used as the importance metric. Select the node with the lowest importance as a pruning candidate. If the matching error is zero after replacing the candidate node with a leaf node, then its subtree is pruned. Iterate until there are no more nodes to prune to obtain the optimal decision tree. Step S8: Input the algebraic property parameters of the matrix to be solved into the optimal decision tree, and output the optimal matrix exponentiation algorithm that uniquely matches the matrix.

2. The adaptive matching model based on the matrix exponentiation algorithm according to claim 1, characterized in that, The condition for determining the low-rank matrix in step S4 is: rank(A) ≤ ε·n, where ε is an adjustable low-rank determination threshold, and ε = 0.1 is taken, and n is the matrix order.

3. The adaptive matching model based on the matrix exponentiation algorithm according to claim 1, characterized in that, The determination condition for the higher-order matrix in step S5 is: the matrix order n > N0, where N0 is an adjustable higher-order threshold.

4. The adaptive matching model based on the matrix exponentiation algorithm according to claim 1, characterized in that, The method for calculating the information gain ratio in step S6 is as follows: taking node purity as the core metric, calculate the information gain ratio of each decision predicate, and select the predicate with the largest gain and the lowest decision complexity as the basis for node splitting.

5. The adaptive matching model based on the matrix exponentiation algorithm according to claim 1, characterized in that, The iteration termination condition of the cost complexity pruning strategy described in step S7 is: the matching error of all leaf nodes is zero, and there are no nodes whose structure can be further simplified by pruning.

6. The adaptive matching model based on the matrix exponentiation algorithm according to claim 1, characterized in that, Each of the six matrix exponentiation algorithms has the following applicable conditions: Matrix diagonalization is applicable to diagonalizable, non-low-rank, and non-normal n-order square matrices. Spectral decomposition is applicable to diagonalizable normal matrices; The nullification method is applicable to low-order square matrices that are not diagonalizable and can be decomposed into the sum of a scalar matrix and a nullification matrix. Rank decomposition is applicable to diagonalizable low-rank square matrices; Jordan's standard form method is applicable to square matrices that are not diagonalizable and cannot be decomposed into zero-power factors; The least polynomial power reduction method is applicable to high-order square matrices that cannot be diagonalized.

7. The adaptive matching model based on the matrix exponentiation algorithm according to claim 1, characterized in that, The optimal decision tree described in step S8 is complete for all n-order square matrices: it divides all n-order square matrices into two categories, diagonalizable and non-diagonalizable, with no overlap between the two categories and full coverage; each internal node is subdivided layer by layer, and all matrices eventually fall into a unique leaf node and are matched with a unique algorithm.

8. The adaptive matching model based on the matrix exponentiation algorithm according to claim 1, characterized in that, It also includes model verification steps: multi-dimensional verification of the model through theoretical verification, typical matrix instance verification, numerical comparison verification, and robustness verification; the theoretical verification verifies the completeness, logical correctness, uniqueness, and optimality of the model; the numerical comparison verification compares the mismatch rate, selection time, and computational complexity of automatic model selection and manual experience selection by randomly generating multiple sets of n-order square matrices of different types; the robustness verification verifies whether the matching algorithm remains unchanged by applying a small numerical perturbation to the matrix and then resubmitting it into the model for judgment.

9. The adaptive matching model based on the matrix exponentiation algorithm according to claim 1, characterized in that, The space complexity of the model is O(n), and the matching time complexity is comparable to the computational complexity of a single matrix exponentiation algorithm.

10. The adaptive matching model based on the matrix exponentiation algorithm according to claim 1, characterized in that, The method is applicable to scenarios involving matrix exponentiation in solving difference equations, calculating state transition probabilities of Markov chains, and analyzing discrete control systems.