British Journal of Applied Science & Technology 18(5): 1-, 2016; Article no.bjast.313 ISSN: 2231-0843, NLM ID: 101664541 SCIENCEDOMAIN international www.sciencedomain.org On the Inverting of a General Heptadiagonal Matri A. A. Karawia 1,2 1 Mathematics Department, Faculty of Science, Mansoura University, Mansoura 35516, Egypt. 2 Computer Science Unit, Deanship of Educational Services, Qassim University, P.O.Bo 6595, Buraidah 51452, Saudi Arabia. Author s contribution The sole author designed, analyzed and interpreted and prepared the manuscript. Article Information DOI: 10.9734/BJAST/2016/313 Editor(s): (1) Orlando Manuel da Costa Gomes, Professor of Economics, Lisbon Accounting and Business School (ISCAL), Lisbon Polytechnic Institute, Portugal. Reviewers: (1) Jia Liu, University of West Florida, USA. (2) Hammad Khalil, University of Education (Attock Campus), Lahore, Pakistan. (3) Gerald Bourgeois, University of French Polynesia and University of Ai-Marseille, France. Complete Peer review History: http://www.sciencedomain.org/review-history/17657 Received: 26 th December 2016 Accepted: 21 st January 2017 Original Research Article Published: 28 th January 2017 ABSTRACT In this paper, the author presents a new algorithm computing the inverse of any nonsingular heptadiagonal matri. The computational cost of our algorithms is O(n 2 ) operations in C. The algorithms are suitable for implementation using computer algebra system such as MAPLE, MATLAB and MATHEMATICA. Eamples are given to illustrate the efficiency of the algorithms. Keywords: Heptadiagonal matrices; LU factorization; Determinants; Computer algebra systems(cas). 2010 Mathematics Subject Classification: 15A15, 15A23, 68W30, 11Y05, 33F10, F.2.1, G.1.0. *Corresponding author: E-mail: abibka@gmail.com;
1 INTRODUCTION The n n general heptadiagonal matrices take the form: H = d 1 e 1 f 1 g 1 c 2 d 2 e 2 f 2 g 2 b 3 c 3 d 3 e 3 f 3 g 3 0 a 4 b 4 c 4 d 4 e 4 f 4 g 4..................... a n 3 b n 3 c n 3 d n 3 e n 3 f n 3 g n 3 0 a n 2 b n 2 c n 2 d n 2 e n 2 f n 2 a n 1 b n 1 c n 1 d n 1 e n 1 a n b n c n d n, n > 4. (1.1) where {a i } 4 i n, {b i } 3 i n, {c i } 2 i n, {d i } 1 i n, {e i } 1 i n, {f i } 1 i n, and {g i } 1 i n are sequences of numbers such that g i 0, g n 2 = g n 1 = g n = 1 and f n 1 = f n = e n = 0. Heptadiagonal matrices frequently arise from boundary value problems. The heptadiagonal systems emanate in many numerical models, for eample the traditional discretization of the implicit method to resolve partial differential equations on 3-D problems with regular grids. Also, these kinds of matrices appear in many areas of science and engineering[[1]-[9]]. So a good technique for computing the inverse of such matrices is required. To the best of our knowledge, the inversion of a general heptadiagonal matri of the form (1.1) has not been considered. In [10], Karawia described a reliable symbolic computational algorithm for inverting general cyclic heptadiagonal matrices by using parallel computing along with recursion. An eplicit formula for the determinant of a heptadiagonal symmetric matri is given in[6]. Many researchers studied special cases of heptadiagonal matri. In [11], the authors presented a symbolic algorithm for finding the inverse of any general nonsingular tridiagonal matri. A new efficient computational algorithm to find the inverse of a general tridiagonal matri is presented in [] based on the Doolittle LU factorization. In [13], the authors introduced a computationally efficient algorithm to obtain the inverse of a tridiagonal matri and a pentadiagonal matri and they assumed few conditions to avoid failure in their own algorithm. The motivation of the current paper is to establish efficient algorithms for inverting heptadiagonal matri. I generalized the algorithm[13] to find the inverse of a general invertible heptadiagonal matri and we presented an efficient symbolic algorithm to find the inverse of such matrices. The development of a symbolic algorithm is considered in order to remove all cases where the numeric algorithm fails when at least one of g i at least equals to 0, i = 1, 2,..., n 3. If, for every i such that g i = 0, then I put g i = t for a small t 0. The current work will be in the field of comple numbers C. The paper is organized as follows: In Section 2, the main result is presented. New numeric and symbolic algorithms are given in Section 3. In Section 4, illustrative eamples are presented. Conclusions of the work are given in Section 5. 2 MAIN RESULTS In this section, we present recurrence formulas for the columns of the inverse of a heptadiagonal matri H. When the matri H is nonsingular, its inversion is computed as follows. Let H 1 = [S ij] 1 i,j n = [Col 1, Col 2,..., Col n] where Col k is the kth column of the inverse matri H 1. 2
By using the fact HH 1 = I n, where I n is the identity matri, the first (n 3) columns can be obtained by relations where E k is the kth unit vector. From (2.1), we note that if we know the last three columns Col n, Col n 1, and Col n 2 then we can recursively compute the remaining (n 3) columns Col n 3, Col n 4,..., Col 1. At this point it is convenient to give recurrence formulas for computing Col n, Col n 1, and Col n 2. Consider the sequence of numbers {A i } 1 i n+3, {B i } 1 i n+3,and {C i } 1 i n+3 characterized by a term recurrence relations and A 1 = 0, A 2 = 0, A 3 = 1, d 1 A 1 + e 1 A 2 + f 1 A 3 + g 1 A 4 = 0, c 2 A 1 + d 2 A 2 + e 2 A 3 + f 2 A 4 + g 2 A 5 = 0, b 3 A 1 + c 3 A 2 + d 3 A 3 + e 3 A 4 + f 3 A 5 + g 3 A 6 = 0, a ia i 3 + b ia i 2 + c ia i 1 + d ia i + e ia i+1 + f ia i+2 + g ia i+3 = 0, i 4, B 1 = 0, B 2 = 1, B 3 = 0, d 1 B 1 + e 1 B 2 + f 1 B 3 + g 1 B 4 = 0, c 2B 1 + d 2B 2 + e 2B 3 + f 2B 4 + g 2B 5 = 0, b 3 B 1 + c 3 B 2 + d 3 B 3 + e 3 B 4 + f 3 B 5 + g 3 B 6 = 0, a i B i 3 + b i B i 2 + c i B i 1 + d i B i + e i B i+1 + f i B i+2 + g i B i+3 = 0, i 4, C 1 = 1, C 2 = 0, C 3 = 0, d 1 C 1 + e 1 C 2 + f 1 C 3 + g 1 C 4 = 0, c 2 C 1 + d 2 C 2 + e 2 C 3 + f 2 C 4 + g 2 C 5 = 0, b 3C 1 + c 3C 2 + d 3C 3 + e 3C 4 + f 3C 5 + g 3C 6 = 0, a ic i 3 + b ic i 2 + c ic i 1 + d ic i + e ic i+1 + f ic i+2 + g ic i+3 = 0, i 4. (2.1) (2.2) (2.3) 3
Now, we can give matri forms for term recurrences (2.2), (2.3) and (2.4) HA = A n+1 E n 2 A n+2 E n 1 A n+3 E n, (2.4) HB = B n+1 E n 2 B n+2 E n 1 B n+3 E n, (2.5) HC = C n+1 E n 2 C n+2 E n 1 C n+3 E n, (2.6) where A = [A 1, A 2,..., A n] t, B = [B 1, B 2,..., B n] t, and C = [C 1, C 2,..., C n] t. Let s define the following determinants: A i A n+2 A n+3 X i = B i B n+2 B n+3, C i C n+2 C n+3 i = 1, 2,..., n + 1, (2.7) Y i = Z i = By simple calculations, we have A i A n+1 A n+3 B i B n+1 B n+3 C i C n+1 C n+3 A i A n+1 A n+2 B i B n+1 B n+2 C i C n+1 C n+2, i = 1, 2,..., n + 2, (2.8), i = 1, 2,..., n + 3. (2.9) HX = X n+1 E n 2, (2.10) HY = Y n+2e n 1, (2.11) HZ = Z n+3 E n, (2.) where X = [X 1, X 2,..., X n ] t, Y = [Y 1, Y 2,..., Y n ] t, and Z = [Z 1, Z 2,..., Z n ] t. Remark 2.1. X n+1 = Y n+2 = Z n+3. Theorem 2.1.(generalization version of theorem 3.1 in [13]) H is invertible iff X n+1 0 and, for every i, g i 0. Moreover [ Z1 Col n =, Z 2,..., Z ] t n, (2.13) X n+1 X n+1 X n+1 Col n 1 = Col n 2 = [ Y1 X n+1, Y 2 X n+1,..., ] t Y n ], (2.14) X n+1 [ ] t X1, X2,..., Xn. (2.15) X n+1 X n+1 X n+1 Proof. Since det(h) = ( n 3 i=1 g i) Xn+1. So if H is invertible then X n+1 0 and if X n+1 0 and g i 0 for every i then det(h) 0 and H is invertible.from (2.11), (2.) and (2.13) we obtain Col n, Col n 1, and Col n 2. The proof is completed. Remark 2.2. If, for every i such that g i = 0, we put g i = t for a small t 0, and if H t=0 is invertible, then X n+1 (t) 0.then H is invertible. 4
3 NEW NUMERIC AND SYMBOLIC ALGORITHMS FOR THE INVERSE OF HEPTADIAGONAL MATRIX In this section, we formulate the result in the previous section. It is a numerical algorithm to compute the inverse of a general heptadiagonal matri of the form (1.1) when it eists. Algorithm 3.1. To find the inverse of heptadiagonal matri (1.1). let f n 1 = f n = e n = 0 and g n 2 = g n 1 = g n = 1. INPUT: Order of the matri n and the components a i, b j, c k, d l, e l, f l, and g l for i = 4, 5,..., n, j = 3, 4,..., n, k = 2, 3,..., n, and l = 1, 2,..., n, OUTPUT: The inverse of heptadiagonal matri H 1. Step 1: Compute the sequence of numbers A i, B i, and C i for i = 1, 2,..., n + 3 using (2.2), (2.3) and (2.4) respectively. Step 2: Compute X i, i = 1, 2,..., n + 1 using (2.8), Y i, i = 1, 2,..., n + 2 using (2.9) and Z i, i = 1, 2,..., n + 3 using (2.10). Step 3: Compute the last three columns Col n, Col n 1, and Col n 2 using (2.14), (2.15), and (2.16) respectively. Step 4: Compute the remaining (n-3)-columns Col j, j = n 3, n 4,..., 1 using (2.1). Step 5: Set H 1 = [Col 1, Col 2,..., Col n ]. The numeric algorithm 3.1 will be referred to as NINVHEPTA algorithm in the sequel. The computational cost of NINVHEPTA algorithm is 11n 2 75n + 21 operations. As can be easily seen, it breaks down unless the conditions g i 0 are satisfied for all i = 1, 2,..., n 3. So the following symbolic algorithm is developed in order to remove the cases where the numeric algorithm fails. Algorithm 3.2. To find the inverse of heptadiagonal matri (1.1). let f n 1 = f n = e n = 0 and g n 2 = g n 1 = g n. INPUT: Order of the matri n and the components a i, b j, c k, d l, e l, f l, and g l for i = 4, 5,..., n, j = 3, 4,..., n, k = 2, 3,..., n, and l = 1, 2,..., n, OUTPUT: The inverse of heptadiagonal matri H 1. Step 1: If g i = 0 for any i = 1, 2,..., n 3 set g i = t(t is just a symbolic name). Step 2: Compute the sequence of numbers A i, B i, and C i for i = 1, 2,..., n + 3 using (2.2), (2.3) and (2.4)respectively. Step 3: Compute X i, i = 1, 2,..., n + 1 using (2.8), Y i, i = 1, 2,..., n + 2 using (2.9) and Z i, i = 1, 2,..., n + 3 using (2.10). Step 4: Compute the last three columns Col n, Col n 1, and Col n 2 using (2.14), (2.15), and (2.16) respectively. Step 5: Compute the remaining (n-3)-columns Col j, j = n 3, n 4,..., 1 using (2.1). Step 6: Substitute the actual value t = 0 in all epressions to obtain the elements of columns Col j, j = 1, 2,..., n. Step 7: Set H 1 = [Col 1, Col 2,..., Col n]. 5
The symbolic algorithm 3.2 will be referred to as SINVHEPTA algorithm in the sequel. The SINVHEPTA algorithm use O(n 2 ) elementary operations. Based on SINVHEPTA algorithm, a MAPLE procedure [14] for inverting a general nonsingular heptadiagonal matri H is listed as an Appendi. 4 ILLUSTRATIVE EXAMPLES In this section we give many eamples for the sake of illustration. Eample 4.1. (Case I: g i 0 for all i) Find the inverse of following 10 10 heptadiagonal matri 2 1 4 1 0 0 0 0 0 0 5 1 1 2 2 0 0 0 0 0 1 2 3 2 7 2 0 0 0 0 6 1 3 2 3 1 3 0 0 0 0 1 1 2 2 3 4 1 0 0 H 1 = 0 0 4 4 4 1 2 1 1 0 0 0 0 1 2 1 3 3 2 1 0 0 0 0 3 1 2 1 11 3 0 0 0 0 0 4 3 2 1 1 0 0 0 0 0 0 7 1 1 2 Solution: By applying the NINVHEPTA algorithm, it yields Step 1: A = [0, 0, 1, 4, 9, 53, 21, 83, 93, 663, 67, 198, 269], 2 4 4 4 2 4 4 B = [0, 1, 0, 1, 3, 13, 19, 41, 47, 341, 53, 107, 4 ], and 2 4 6 3 3 C = [1, 0, 0, 2, 9 2, 53 4, 67, 269, 221 6, 1781, 881, 578 3, 730 3 ]. Step 2: X = [ 4231 3, 10942, 2146 3 3 (4.1), 3688, 4687 2, 31741, 19873, 51721, 19773 2, 154735, 905413 ], Y = [ 1983 4, 62693 4, 11759 6, 82109, 49839 4, 220819, 141107, 53 3, 160577, 563539, 0, 905413 ], and Z = [ 3325, 33928, 211, 22109, 7763, 19327, 84955, 50981, 15235, 76363, 0, 0, 905413 ]. 3 6 2 4 6 Step 3: Col 10 = [ 3325, 1357, 211, 44218, 93156, 115962, 84955, 50981, 45705, 152726 905413 905413 905413 905413 905413 905413 905413 905413 905413 905413 ]t, Col 9 = [ 5949 905413, 188079 905413, 23518 905413, 82109 905413, 149517 905413, 220819 905413, 141107 905413, 248 905413, 160577 905413, 563539 905413 ]t,and Col 8 = [ 16924 905413, 43768 905413, 8584 905413, 44256 905413, 282 905413, 31741 905413, 19873 905413, 51721 905413, 118638 905413, 154735 905413 ]t. 6
Step 4: Col 7 = [ 51473 905413, 214649 905413, 6848 905413, 139095 905413, 1161 905413, 106328 905413, 88422 905413, 278373 905413, 103927 905413, 500627 905413, ]t, Col 6 = [ 80594 905413, 217 905413, 83035 905413, 170735 905413, 10659 905413, 31638 905413, 14393 905413, 84414 905413, 14531 905413, 15434 905413 ]t, Col 5 = [ 82176 905413, 447486 905413, 28082 905413, 170806 905413, 175068 905413, 6589 905413, 102273 905413, 9510 905413, 78091 905413, 392246 905413 ]t, Col 4 = [ 205297 905413, 910556 905413, 6935 905413, 472222 905413, 410790 905413, 147233 905413, 42741 905413, 427692 905413, 147953 905413, 9724 905413 ]t, Col 3 = [ 2619 905413, 30890 905413, 25421 905413, 1378 905413, 172515 905413, 19216 905413, 46090 905413, 62775 905413, 11493 905413, 198449 905413 ]t, Col 2 = [ 29328 905413, 877900 905413, 53389 905413, 605688 905413, 491917 905413, 172702 905413, 34896 905413, 501141 905413, 156703 905413, 50083 905413, ]t, and Col 1 = [ 88555 905413, 552363 905413, 5378 905413, 28648 905413, 88835 905413, 19552 905413, 17938 905413, 61611 905413, 46355 905413, 55155 905413 ]t. Step 5: Eample 4.2.(Case II: g i = 0 for at least one of i) Find the inverse of following 5 5 heptadiagonal matri 2 3 4 1 0 1 1 2 3 0 H 2 = 3 5 1 1 2 4 1 3 2 6 0 2 1 4 3 (4.2) Solution: i- By applying the NINVHEPTA algorithm, it breaks down since g 2 = 0. ii- By applying the SINVHEPTA algorithm, it yields Step 1: A = [0, 0, 1, 4, 14 1, 5 +28, 5 84, 3 5 +14 ], B = [0, 1, 0, 3, 8 1, 8 +2, 7 48, 2 5 + ], and C = [1, 0, 0, 2, 7 1, 5 +14, 42 1, 8 +21 ]. 7
Step 2: X = [ Y = [ 2 55 +294, 63+40, 183+56, 3 2 +15, 79 1, ], 35 +88, 7 5 +13, 2 7 +18 21 +65,, 14 1, 0, Z = [ 5 548, 5 5 28 35 +194,, 25 3 +4, 325 1, 0, 0, ], and ]. Step 3: Col 5 = [ 5 548, 5 5 28 35 +194,, 25 3 +4, 325 ]t, Col 4 = [2 Col 3 = [ Step 4: Col 2 = [ Col 1 = [ 5 5 10 56 Step 5: H 1 2 = Step 6: H 1 2 = 35 +88 5 +13 7 +18, 7, 2, 21 +65, 14 ]t, and 55 +294, 63+40, 183+56, 3 2 +15, 79 ]t. 545, 205, 91, 111, 315 ]t, and 13 +3, 10 +19, 56 2 +7 33 +7,, 248 ]t. 13 +3 +19 2 +7 33 +7 248 615 545 190 392 7 248 205 545 205 55 +294 35 +88 2 5 548 63+40 7 5 +13 5 5 28 91 183+56 2 7 +18 111 3 2 +15 315 79 294 176 548 63 91 140 91 183 36 194 111 45 315 79 65 100 14 325. 35 +194 21 +65 3 +4 25 14 325 Eample 4.3. We consider the following n n heptadiagonal matri in order to demonstrate the efficiency of SINVHEPTA algorithm. H = 2 1 2 1 3 2 1 2 1 1 3 2 1 2 1 0 2 1 3 2 1 2 1..................... 2 1 3 2 1 2 1 0 2 1 3 2 1 2 2 1 3 2 1 2 1 3 2 =0. (4.3) In Table 1. we give a comparison of the mean time between SINVHEPTA, CHEPTA[10] (symbolic algorithm to find the inverse of Cyclic Heptadiagonal matri) algorithms and MatriInverse function in Maple 13.0 for different orders, over 100 trials. It was tested in an Intel(R) Core(TM) i7-4700mq CPU@2.40GHz 2.40 GHz. Eample 4.4. The performance of the algorithm NINVHEPTA is recorded in table 2, which gives us the mean values of time elapsed(in seconds) and relative error H H 1 I n F / I n F, over 100 trials, for the computation of the inverse of a heptadiagonal matri H with random integers entries h ij for i j 3 and with nonzero entries on its third superdiagonal, and h ij = 0 otherwise. 8
Table 1. The mean values of the time elapsed(in seconds) over 100 trials, of the proposed algorithm, CHEPTA[10] algorithm and MatriInverse function in Maple 13.0. Algorithms n 10 20 50 100 150 200 500 SINVHEPTA Mean time(s) 0.00563 0.01326 0.08171 0.44915 1.29597 2.95462 48.74440 CHEPTA[10] Mean time(s) 0.00233 0.01189 0.06819 0.43924 1.27376 2.95963 49.35749 MatriInverse Mean time(s) 0.00375 0.015 0.17214 1.31768 4.41329 10.82438 198.68109 Table 2. The mean values of the time elapsed(in seconds)and the mean of the relative error(mre) H H 1 I n F / I n F, over 100 trials, of the proposed algorithm, NINVHEPTA algorithm to obtain more accurate information about the full inverse of a random heptadiagonal matri H. n 10 20 50 100 150 200 500 Mean time(s) 5.60e 3 1.36e 2 7.68e 2 3.37e 1 9.24e 1 2.05 5.74 MRE 4.e 14 7.42e 13 1.62e 8.09e 5.38e 11 9.66e 11 3.54e 10 5 CONCLUSIONS In this work new numeric and symbolic algorithms have been developed for finding the inverse of any nonsingular heptadiagonal matri. The symbolic algorithm removes the cases where the numeric algorithms fail when at least one of g i = 0, i = 1, 2,..., n 3. It has the smallest mean time the methods in literature for large sizes. ACKNOWLEDGEMENT The author would like to thank anonymous referees for pointing out several comments and suggestions. COMPETING INTERESTS Author has declared that no competing interests eist. References [1] Böttcher A, Grudsky S. Spectral Properties of Banded Toeplitz Matrices. SIAM, Philadelphia; 2005. [2] Golub GH, Van Loan CF. Matri Computations. third ed., The Johns Hopkins University Press, Baltimore and London; 1996. [3] Burden RL, Faires JD. Numerical Analysis. seventh ed., Books & Cole Publishing, Pacific Grove, CA; 2001. [4] Yamamoto T, Ikebe Y. Inversion of band matrices. Linear Algebra Appl. 1979;24:105-111. [5] Trench WF. An algorithm for the inversion of finite Toeplitz matrices. J. SIAM. 1964;:515-522. [6] Elouafi M. A note for an eplicit formula for the determinant of pentadiagonal and heptadiagonal symmetric Toeplitz matrices. Appl. Math. Comput. 2013;219:4789-4791. [7] Solary M. Finding eigenvalues for heptadiagonal symmetric Toeplitz matrices. J. Math. Anal. Appl. 2013;402:719-730. [8] Ting D, Gu M, Chi X, Cao J. Numerical Acceleration of Three-Dimensional Quantum Transport Method Using a Seven- Diagonal Pre-Conditioner. J. Comput. Electron. 2002;1:93-97. [9] Gu S, Peng J, Cui R. A Polynomial Time Solvable Algorithm to Binary Quadratic Programming Problems with Q Being a Seven-Diagonal Matri and Its Neural Network Implementation. Advances in Neural Networks ISNN 2014, Lecture Notes in Computer Science. 2014:338-346. [10] Karawia AA. Inversion of General Cyclic Heptadiagonal Matrices. Math. Probl. Eng. 2013;9. Article ID 321032. [11] El-Mikkawy M, Karawia AA. Inversion of general tridiagonal matrices. Appl. Math. Lett. 2006;19:7-720. 9
[] El-Mikkawy M. On the inverse of a general tridiagonal matri. Appl. Math. Comput. 2004;150:669-679. [13] Hadj A, Elouafi M. A fast numerical algorithm for the inverse of a tridiagonal and pentadiagonal matri. Appl. Math. Comput. 2008;202:441-445. [14] Maple software. Available: http://www.maplesoft.com/ 10
11
- c 2016 Karawia; This is an Open Access article distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/4.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. Peer-review history: The peer review history for this paper can be accessed here: http://sciencedomain.org/review-history/17657