A Practical Implementation of Modular Algorithms for Frobenius Normal Forms of Rational Matrices
Total Page:16
File Type:pdf, Size:1020Kb
Vol. 45 No. 6 IPSJ Journal June 2004 Regular Paper A Practical Implementation of Modular Algorithms for Frobenius Normal Forms of Rational Matrices Shuichi Moritsugu† Modular algorithms for computing the Frobenius normal forms of integer and rational ma- trices are presented and their implementation is reported. These methods compute Frobenius normal forms over Zpi , where pi’s are distinct primes, and then construct the normal forms over Z or Q by the Chinese remainder theorem. Our implementation includes: (1) detection of unlucky primes, (2) a new formula for the efficient computation of a transformation ma- trix, and (3) extension of our preceding algorithm over Z to one over Q. Through experiments using a number of test matrices, we confirm that our modular algorithm is more efficient in practical terms than the straightforward implementation of conventional methods. • the structure of eigenvectors or generalized 1. Introduction eigenvectors. In a previous paper19), we studied a mod- In addition, algorithms for symbolic computa- ular algorithm for the exact computation of tion of Jordan normal forms can be realized by Frobenius normal forms of integer matrices, and transforming the Frobenius normal forms9),20). substantiated its efficiency by computational Therefore, Frobenius normal forms are the most experiments. In this paper, we extend the suitable for constructing linear algebra algo- above algorithm to the case of rational matri- rithms by means of computer algebra systems. ces. We propose several algorithms and com- They also have important applications such as pare their efficiency and effectiveness through the eigenvalue method for solving systems of experiments. algebraic equations22),23),30). The motivation for these studies is the fact Algorithms for Frobenius normal forms have that computing various types of normal forms been discussed in a number of papers, but these of matrices is a very important subject in sym- have been concerned mainly with the theoreti- bolic linear algebra. In particular, the Jordan cal computational complexity. As an improve- normal form is theoretically fundamental, but it ment over the classical O(n4) algorithm16),26), requires an algebraic extension field to which all the O(n3) algorithm was proposed in Storjo- the eigenvalues belong. Hence, we have to han- hann 29), and a series of algorithms by Gies- dle algebraic numbers efficiently in computer brecht6)∼8) are known to give the best complex- algebra systems, but this is often so difficult ity. Nevertheless, implementations of such algo- that computing Jordan normal forms becomes rithms have rarely been reported, and Maple2) generally inefficient. is the only existing commercial computer alge- In contrast, the Frobenius normal form is bra system to provide a function for Frobenius computed only by rational operations of the normal forms. matrix elements without algebraic extensions, The purpose of this paper is to describe the and it is absolutely unique, while the Jordan implementation of computing normal forms and normal form is unique up to the permutation of transformation matrices, comparing algorithms Jordan blocks. Moreover, the Frobenius normal from a practical point of view. The algorithm form provides the same detailed information on adopted here belongs to the O(n3 log n) class1) the matrix as the Jordan normal form; for ex- and is not necessarily optimal. However, in- ample24): stead of precise analysis of the complexity, we • the characteristic polynomial, focus on the practical application of modular • the minimal polynomial, methods for the computation of normal forms. • the algebraic and geometric multiplicities The basic idea of the modular algorithm of the eigenvalues, and was first explained by Howell12), where only Frobenius normal forms are computed, with- † Institute of Library and Information Science, Uni- out transformation matrices. In Mathieu and versity of Tsukuba Ford18) and Mukhopadhyay25), p-adic methods 1630 Vol. 45 No. 6 Implementation of Modular Algorithms for Frobenius Normal Forms 1631 for the computation of characteristic polyno- 01 mials were proposed, in which only block di- .. agonalized forms or upper triangular forms are 00 . O computed. The latest paper by Giesbrecht and C = . (1) . .. .. Storjohann8) also describes a modular method 00··· 01 and an algorithm for a transformation ma- c c ··· c c trix. The detection of unlucky primes is treated 0 1 n−2 n−1 in both Howell12) and Giesbrecht and Storjo- is called the companion matrix associated with 8) n n−1 hann , but since the notions in those stud- the polynomial f(x)=x − cn−1x −···− ies are slightly different, the procedure is eluci- c1x − c0. In particular, the companion matrix dated in this paper from the viewpoint of actual associated with the polynomial of degree one implementation. f(x)=x − c0 is the 1 × 1 square matrix [c0]. As another approach for Frobenius normal Lemma 2. The characteristic polynomial forms, we previously proposed a fraction-free ϕC (x) and the minimal polynomial φC (x) of the algorithm21) for polynomial matrices. This al- companion matrix C are equal to the associated n n−1 gorithm is also applicable to integer matrices, polynomial f(x)=x −cn−1x −· · ·−c1x−c0. but it does not necessarily yield a dramatic im- provement in efficiency. In this paper, there- Theorem 3 (Frobenius Normal Form). fore, we apply modular methods to integer and (i) Using a suitable regular matrix S, every rational matrices, and focus particularly on the n × n square matrix A can be transformed following: into a block diagonal matrix as follows: −1 • detection of unlucky primes and its imple- F = S AS = C1 ⊕ C2 ⊕···⊕Ct. (2) mentation, This is called the Frobenius normal form (or • efficient computation of transformation rational normal form) of A. Each block ma- matrices with simple elements, and trix Ci (i =1, ···,t)isadi × di compan- • recovery of rational numbers and algo- ion matrix in the form of Eq.(1), and the rithms for rational matrices. associated polynomial ϕi+1(x)ofCi+1 di- The implementation for integer matrices was vides the associated polynomial ϕi(x)ofCi reported in our previous paper19). Theories (i =1,...,t− 1). necessary for both integer matrices and ratio- (ii) For every given matrix A, its Frobenius nal matrices are summarized here in sections 2 normal form F of Eq.(2) is uniquely deter- and 3. We show an extension of the method mined, while a transformation matrix S is to rational matrices in section 4, and discuss not unique. Furthermore, the minimal poly- its efficiency with reference to the experimental nomial of A is given by φA(x)=ϕ1(x), and results in section 5. Most other papers discuss the characteristic polynomial of A is given by only integer matrices, because it is theoretically ϕA(x)=ϕ1(x) · ϕ2(x) ···ϕt(x). sufficient to extract the common denominator For the computation of characteristic poly- of rational matrices. However, our results show nomials, there is a similar algorithm using ma- that such an approach is quite inefficient in ac- trix block diagonalization, as in Eq.(2), known tual implementation. as Danilevskii’s method3),4), where the condi- tion ϕt(x) | ϕt− (x) |···|ϕ (x) is not required. 2. Frobenius Normal Forms of Matri- 1 1 Hence, the result given by Danilevskii’s method ces is not unique and ϕ1(x) is not necessarily iden- In the following sections, we assume that the tical to the minimal polynomial of A. elements of a given matrix are rational num- The normal form in the strict sense of bers; that is, A =[aij] ,aij ∈ Q. Refer to text- Theorem 3 is deduced by the constructive books by Iri and Kan13) and Kan and Iri14) for proof of the “cyclic decomposition theorem details of the normal forms theory. of a finite-dimensional vector space”5),11),13). Definition 1 (Companion Matrix). The computational complexity is analyzed as The following n × n square matrix O(n3 log n)1), where O(n3) corresponds to basic matrix operations such as multiplication, and O(log n) is interpreted as the number of com- panion blocks t in the normal form of Eq.(2). However, instead of the “constructive proof” 1632 IPSJ Journal June 2004 above, this paper adopts the algorithm ex- adopt the form in Definition 1 for the symbolic pressed by the composition of elementary trans- formulation of eigenvectors. Let S−1AS = C formations14), which is the conversion by the in Eq.(1), and let λ be a root of the associated authors of 13) themselves. To our knowledge, polynomial f(x)ofC. If we put there is nothing in the English literature that n− T u := 1,λ,λ2,...,λ 1 , gives such an algorithm explicitly, even though the formulation in Iri and Kan13) is essentially then we have Cu = λu, A(Su)=λ(Su). identical to that in Hoffman and Kunze11). These relations give the symbolic expression of According to the formulation in Kan and an eigenvector of C and A with the eigenvalue Iri14), we eliminate the elements step by λ. (Hence, we do not compute S−1 in the actual step analogously to the Gaussian elimination implementation.) method, and finally obtain the normal form F Remark 2. If all the elements of A are in- as well as a transformation matrix S. The num- tegers, then its Frobenius normal form F con- ber of loop counts is not stable, but depends on sists only of integers. On the other hand, we can the arrangement of the elements in the original take the transformation matrices S and S−1 so matrix A. However, this algorithm, whose com- that only one of them is integral, even though plexity is also considered to be O(n3 log n), is A is rational. There exists no known algorithm certainly deterministic. In order to compute a that yields both S and S−1 as integer matrices.